Combine Data Sets

Join matching rows from b to a.

dplyr::lef_join(a, b, by = "x1")

Join matching rows from a to b.

dplyr::right_join(a, b, by = "x1")

Join data. Retain only rows in both sets.

dplyr::inner_join(a, b, by = "x1")

Join data. Retain all values, all rows.

dplyr::full_join(a, b, by = "x1")

All rows in a that have a match in b.

dplyr::semi_join(a, b, by = "x1")

All rows in a that do not have a match in b.

dplyr::anti_join(a, b, by = "x1")

Rows that appear in both y and z.

dplyr::intersect(y, z)

Rows that appear in either or both y and z.

dplyr::union(y, z)

Rows that appear in y but not z.

dplyr::setdiff(y, z)

Append z to y as new rows.

dplyr::bind_rows(y, z)

Append z to y as new columns. Caution: matches rows by position.

dplyr::bind_cols(y, z)

Comments