I'm trying to create a line of code in R that does the same as the following one in Stata
by country essround: egen mpppincome=mean(income_ppp2010)
But I'm not really sure how to proceed
Any ideas? (The line is supossed to calculate the mean income per country and year from the dataset, which contains income measures from individuals with a country identifying variable and a year identifying variable)