Week 1 · R & regression unit
Hello, R
What did Luz's truck sell last week?
What you’ll be able to do
- Identify the Console, scripts, objects, and vectors in an R workspace.
- Apply assignment and vector functions to calculate sales totals and averages.
- Explain a calculated result using appropriate business units.
Luz runs the Luz’s Tacos food truck. She writes her daily sales in a notebook and wants to know what drives a good day. R is a free calculator-on-steroids that can help her. This week you just learn to talk to it.
Start here: Hello, R
Read Module 1 video transcript
Words to know
- Console:
- The box where you type a command and R answers back.
- Object:
- A labelled container. You put a value in and use the label later.
- Vector:
- A list of values, like a row of numbers in a notebook.
Follow along
1.Scroll to Your R workspace below, press Start R, type this and press Run. R works like a calculator.
312 + 287[1] 599
2.Store last week's daily sales in an object called sales. The arrow <- means 'put this into'. c() means 'combine'.
sales <- c(856, 990, 1135, 702, 1180, 1227, 948)
sales[1] 856 990 1135 702 1180 1227 948
3.Ask R questions about the week.
sum(sales)
mean(sales)
max(sales)[1] 7038 [1] 1005.429 [1] 1227
Your R workspace
Thetruck data is already loadedResults and charts appear here.
Activity checks
Use these object names in your code. Checks run each time you press Run. Unlimited attempts. If you’re logged in, your best result is saved and your class teacher can see it.
- ⬜ Create tacos with the 7 daily counts
- ⬜ Store the average in avg_tacos
- ⬜ Store taco revenue in revenue
Your code is kept in this browser only. Download it to keep a copy.
Activity
Luz's notebook
- Create an object called tacos with the number of tacos sold each day: 210, 240, 280, 170, 300, 330, 230.
- What was the average number of tacos per day?
- If each taco costs $4, use R to work out total taco revenue: sum(tacos) * 4.

Ask the tutor
Paste your R code, an error, or your output and ask anything.
Check your understanding
Week 1 quiz
Week 1 review
- R answers commands typed in the Console.
- <- stores a value in an object; c() combines values into a vector.
- sum(), mean() and max() summarise a vector.
Coming up: Week 2
Data frames: R's spreadsheet
How do we load a month of sales?
Luz typed 30 days of records into a spreadsheet.