FAQs on the exercise Calculating Column Statistics
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
I don’t understand why all of the examples in the prompt begin with the select() function, as that indicates you need to specify which column you are operating on. I guess you don’t have to do that, as the actual example in the instructions doesn’t require that step. So I guess it’s unnecessary?
You may be getting a failure from the grading system since it’s scoring based on your input and not your output. While you use a different syntax, you are still “piping” orders. What is the column name you get when you don’t use the recommended syntax?
I was confused by this assignment too. But after completing the assignment that comes after this one, it all makes sense to me now.
They simply want to demonstrate the syntax for aggregating in R.
We’re basically creating a new DF under a new variable name with new columns that is the aggregated data, while dropping the original columns. It is kind of similar to transmute().
# assigning new DF name:
most_expensive <- orders %>%
# The following line is unnecessary, but it follows the same syntax when we start using groupby() in the next assignment. Same logic as a default parameter :
select(price) %>%
# summarize aggregates the data into one row, it doesn't make sense now but it will when you apply groupby() on the next assignment.
summarize(new_column_name = max(price, na.rm=TRUE))
most_expensive