safe_join.data.frame {nonmemica} | R Documentation |
Joins data frames safely. I.e., a left join that cannot alter row order or number. Supports the case where you only intend to augment existing rows with additional columns and are expecting singular matches. Gives an error if row order or number would have been altered by a left join.
## S3 method for class 'data.frame'
safe_join(x, y, ...)
x |
data.frame |
y |
data.frame |
... |
passed to dplyr::left_join |
Other safe_join:
safe_join()
library(magrittr)
x <- data.frame(code = c('a','b','c'), value = c(1:3))
y <- data.frame(code = c('a','b','c'), roman = c('I','II','III'))
x %>% safe_join(y)
try(
x %>% safe_join(rbind(y,y))
)