I’m trying to combine 2 data frames by Genus name using left_join
, one holding measurements, the other holding taxonomic info.
This is what I’m trying:
joined <- left_join(taxonomy, x, by = join_by(Genus == Genus), relationship = 'many-to-one', multiple = 'all')
And this is the error I keep getting:
Error in left_join(): ! Each row in x must match at most 1 row in y. ℹ Row 1 of x matches multiple rows in y
when I try to just use merge
like this:
joined2 <- merge(taxonomy, x, all.y = TRUE, by = "Genus")
It creates duplicates in the species column to account for the data frames being different sizes.
Can anyone explain the error to me and perhaps suggest a work around?
14avls is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.