safe_join.data.frame {nonmemica} | R Documentation |
Join Data Frames Safely
Description
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.
Usage
## S3 method for class 'data.frame'
safe_join(x, y, ...)
Arguments
x |
data.frame |
y |
data.frame |
... |
passed to dplyr::left_join |
See Also
Other safe_join:
safe_join()
Examples
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))
)
[Package nonmemica version 1.0.8 Index]