R/S-Plus: How can I merge two dataframes of different lengths?
November 19, 2010 2:06 PM Subscribe
Merging datasets in R. I seem to have forgotten how to do some things.
posted by proj to computers & internet (3 answers total) 2 users marked this as a favorite
I have a dataframe of individual-level data in which rows are individuals are columns are variables (257,597 individuals in 87 countries) . I also have a dataframe of country-level data in which rows are countries and columns are variables. I want to merge these two dataframes so that individuals have the country-level data as well (meaning that the country-level value is repeated for each individual in a country). The problem -- the country-level dataframe has 182 countries, meaning that some of the countries don't match what's in the individual-level dataframe.
How can I merge these two dataframes without opening the country-level dataframe in Excel and removing by hand all of the countries that are not represented at the individual-level?