merge_by_date_interval: Merging datsets by date intervals

Description Usage Arguments Value Examples

Description

Merging datsets by date intervals

Usage

1
2
merge_by_date_interval(data1, data2, key_col = "country_name", startdate1,
  enddate1, startdate2, enddate2, group_vars = NULL)

Arguments

data1
data2
key_col
startdate1
enddate1
startdate2
enddate2
group_vars

Value

A dataset merging data1 and data2 by the key_col with each row of data1 split according to which part of it falls within the intervals in data2

Examples

1
2
3
4
5
library(dplyr)
data1 <- archigos %>% select(country_name,obsid,leader,startdate,enddate) %>% filter(country_name == "Cuba")
data2 <- polity_cases %>% select(country_name, polity, polity_startdate, polity_enddate) %>% filter(country_name == "Cuba")
results <- merge_by_date_interval(data1, data2, "country_name", "startdate", "enddate", "polity_startdate", "polity_enddate", "obsid")
results

xmarquez/PoliticalDatasets documentation built on May 4, 2019, 1:24 p.m.