When preparing a monthly sales report in R, you load the orders CSV into a tibble named orders_tbl. You need to add a column called total_value that multiplies quantity by unit_price, keeping all existing columns in the data set. Following tidyverse conventions, which single function should you use to create the new column inside the table?
The tidyverse verb that creates or modifies columns in place is mutate(). Using orders_tbl %>% mutate(total_value = quantity * unit_price) returns the original tibble with the new total_value column appended, leaving all other columns unchanged. summarise() would collapse the data into summary rows, filter() keeps or discards rows based on conditions, and select() chooses which columns to retain but cannot create new ones. Therefore, mutate() is the appropriate function.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the `mutate()` function do in R?
Open an interactive chat with Bash
What is the difference between `mutate()` and `summarise()`?
Open an interactive chat with Bash
Why is tidyverse commonly used for data manipulation in R?
Open an interactive chat with Bash
CompTIA Data+ DA0-002 (V2)
Data Concepts and Environments
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .