Repair a hidden session dependency

A consultant intends to charge 55 Canadian dollars per hour for four hours. The saved script is:


R
service_hours <- 4
hourly_fee <- 55
estimate <- service_hours * hourly_rate
print(estimate)


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?

Choose an answer

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: