I would like to ask how to manipulate panel dataset in R, lets say he have following dataset:
df <- data.frame(
Country = c("Alb", "Alb", "Alb", "Alb", "Rus", "Rus", "Rus", "Rus", "Uk", "Uk", "Uk", "Uk"),
Year = c(2010, 2010, 2011, 2011, 2010, 2010, 2011, 2011, 2010, 2010, 2011, 2011),
Value = c(55, 60, 75, 80, 45, 50, 110, 111, 101, 85, 45, 65)
)
df
what I need to end up with is resamplet dataset that would look like:
Country Year Value
Alb 2010 115
Alb 2011 155
...
I tought about using group_by
in dplyr however I do not know how to solve this even thou it should be pretty easy.