Sorting columns and counting


I have a dataset with videogames.
I have a column with 12 different type of genre, and i have a column with EU_sales.

I want to know how much EU_sales te music genre has.

So i tired this one:

music <- videogames %>%
filter (Genre == 'Misc' 'EU_Sales') %>%
count ()

But i have a error with: Error in group_vars(x) : argument "x" is missing, with no default

can anyone please help me?

filter() operates on rows, not columns. So you'll probably need to reshape your data first. Would it be possible for you to prepare a minimal reproducible example of the videogames data set. See the guide below for instructions.

OK, I misunderstood your description of the data set. Since your genres are already in rows, you can just do something like this.

videogames %>%
  filter(Genre == "Misc") %>%
  summarise(Total_EU_Sales = sum(EU_Sales))

thank you so much for helping me !

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.