Hi
I am trying to collapse the observations by country year group.
I used group_by function in tidyverse and then piped it to summarize_all but that didn't work.
What I want is something like collapse in stata where the values are summed for the required varlist and then reported by country group year.
I want summed values for these variables: f; ext_type; oth_exclusions; franchise_age
The data is available here: https://drive.google.com/open?id=16OQ5VxiBG7dEepP6mXny8iAKpF2SRKi5
My code:
library(haven)
PIPE_081813 <- read_dta("G:/Rajesh_Ramachandran/PIPE_081813.dta")
#group by country year
library(tidyverse)
library(tidyr)
data_2= PIPE_081813 %>%
select(c("countryn", "country", "year","f", "ext_type", "oth_exclusions", "franchise_age"))
#grouping the sasaki data at the country year level
ds3= data_2%>%
group_by(countryn, year) %>%
summarize_all()
#> Error in inherits(x, "fun_list"): argument ".funs" is missing, with no default