Rebuild and update an equipment quote

Mark Yourself Question

  1. Grab a piece of paper and try this problem yourself.
  2. When you're done, check the "I have answered this question" box below.
  3. View the solution and report whether you got it right or wrong.

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:


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.

  • Explain why its first command fails.
  • Rewrite the complete script so it calculates and explicitly displays the five-day quote. Show the expected result in Canadian dollars.
  • After running your corrected script, suppose you append days <- 6 followed by print(project_cost). Explain what would be displayed, then write the commands needed to display the correct six-day quote.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More R Programming Basics Questions: