First, I promise I looked for the answer first. I only started learning R yesterday and the question very basic. So either it's too basic to have been asked or I don't realize I'm reading the answer.
Basically, this is the task in this exercise (don't worry, it's not a test):
You can also use the
mutate()
function to make changes to your columns. Let's say you wanted to create a new column that summed up all the adults, children, and babies on a reservation for the total number of people. Modify the code chunk below to create that new column:
example_df <- bookings_df %>%
mutate(guests = )
head(example_df)
There are three columns ("adults", "children", and "babies") whose values I want to add in the new column called "guests". So i tried
example_df <- bookings_df %>%
mutate(example_df, guests = c("adults", "children", "babies"))
head(example_df)
And of course, it comes back with an error "guests
must be size 119390 or 1, not 3."
Now, up until this point, I haven't learned any advanced functions. So the answer is going to be something extremely basic for a first week R student.
Help?