Hallo,
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 repr oducible ex ample of the videogames
data set. See the guide below for instructions.
Why reprex?
Getting unstuck is hard. Your first step here is usually to create a reprex, or reproducible example. The goal of a reprex is to package your code, and information about your problem so that others can run it and feel your pain. Then, hopefully, folks can more easily provide a solution.
What's in a Reproducible Example?
Parts of a reproducible example:
background information - Describe what you are trying to do. What have you already done?
complete set up - include any library() calls and data to reproduce your issue.
data for a reprex: Here's a discussion on setting up data for a reprex
make it run - include the minimal code required to reproduce your error on the data…
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 !
system
Closed
June 16, 2020, 5:12pm
6
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.