Problem with summarize in r



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:

My code:

PIPE_081813 <- read_dta("G:/Rajesh_Ramachandran/PIPE_081813.dta")

#group by country year

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) %>%
#> Error in inherits(x, "fun_list"): argument ".funs" is missing, with no default


Hi, summarize_all gave you an error that should point to the right direction. With experience you'll understand those errors better.

What it complains about right now is that you didn't provide any function that would summarize all of your columns. In fact, you can put any summarizing function in, as long as it returns a single number (sum, mean, median, min, max...). In your case I suspect you need to use sum and it should give you the result you want.

In future, asking a question will result in a more satisfying result for you if you can provide a reprex: