I would like to add only one variable (or maybe a list of variables based on some pattern) from a data frame 'y' to the data frame 'x' (both containing information on the same individuals), without having to explicitly specifying 'by =' (hence, I want a natural join based on all variables in x and y). I currently do this in this way, but I think it would be reasonable to build this into the '*_join()' functions:
x <- starwars %>% select(height, mass, hair_color, birth_year); y <- starwars %>% select(height, mass, hair_color, birth_year, homeworld, species); vars <- c(names(x), "species"); x <- x %>% left_join(y, na_matches = 'never') %>% select(vars)
I am happy to discuss if there is already a better solution for this or if there is really a need to add this. Thank you.