Mark Yourself Question
An equipment-hire quote consists of a booking fee of 36 Canadian dollars plus 24 Canadian dollars per day. Tax is excluded. A colleague saves these commands in equipment_quote.R:
print(project_cost) project_cost <- booking_fee + day_fee * days booking_fee <- 36 day_fee <- 24 days <- 5
Assume the script is first run in a fresh R session.
Unlock full course notes by signing up
Trace a stored subtotal
An office manager runs all these R commands in the order shown. The unit price is in Canadian dollars, and items is the number ordered.
What happens at the final command?
Check arithmetic before building a price
Before building a pricing calculation, an analyst checks how R evaluates the following arithmetic expressions. Complete the table with the exact integer stored in each object.
Apply named arguments and default values
A service business uses the following R function to calculate a charge in dollars. The hourly rate is in dollars per hour, and the booking fee is in dollars. No taxes or other charges apply.
Calculate the dollar amount returned by each call below. Enter both amounts to two decimal places.
Repair a hidden session dependency
A consultant intends to charge 55 Canadian dollars per hour for four hours. The saved script is:
In the author's session, hourly_rate already contains 70 from earlier work, so the script displays 280. In a colleague's fresh session, it stops with an object-not-found error for hourly_rate.
Which change makes the saved script self-contained and calculates the intended estimate?