Programming with dplyr
Dr. Chester Ismay
Educator, Data Scientist, and R/Python Consultant
uruguay_imf_filtered
# A tibble: 5 x 3
iso country year
<chr> <chr> <int>
1 URY Uruguay 2010
2 URY Uruguay 2011
3 URY Uruguay 2012
4 URY Uruguay 2013
5 URY Uruguay 2014
uruguay_wb_filtered
# A tibble: 4 x 3
iso country year
<chr> <chr> <dbl>
1 URY Uruguay 2013
2 URY Uruguay 2014
3 URY Uruguay 2015
4 URY Uruguay 2016
setdiff(uruguay_imf_filtered, uruguay_wb_filtered)
# A tibble: 3 x 3
iso country year
<chr> <chr> <dbl>
1 URY Uruguay 2010
2 URY Uruguay 2011
3 URY Uruguay 2012
union_one_way <- union(uruguay_imf_filtered,
uruguay_wb_filtered)
union_one_way
# A tibble: 7 x 3
iso country year
<chr> <chr> <dbl>
1 URY Uruguay 2010
2 URY Uruguay 2011
3 URY Uruguay 2012
4 URY Uruguay 2013
5 URY Uruguay 2014
6 URY Uruguay 2015
7 URY Uruguay 2016
union_other <- union(uruguay_wb_filtered,
uruguay_imf_filtered)
union_other
# A tibble: 7 x 3
iso country year
<chr> <chr> <dbl>
1 URY Uruguay 2013
2 URY Uruguay 2014
3 URY Uruguay 2015
4 URY Uruguay 2016
5 URY Uruguay 2010
6 URY Uruguay 2011
7 URY Uruguay 2012
setequal(union_one_way, union_other)
[1] TRUE
Programming with dplyr