0
0
R Programmingprogramming~10 mins

Variable assignment (<- and =) in R Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Variable assignment (<- and =)
📖 Scenario: You are learning how to store information in R using variables. Variables are like labeled boxes where you keep values. In R, you can assign values to variables using two common symbols: &lt;- and =.Imagine you want to keep track of the number of apples you have. You can put that number in a box called apples using either &lt;- or =.
🎯 Goal: You will create two variables called apples and oranges. You will assign the number 10 to apples using &lt;- and the number 5 to oranges using =. Then you will print both variables to see their values.
📋 What You'll Learn
Create a variable called apples and assign it the value 10 using <-
Create a variable called oranges and assign it the value 5 using =
Print the value of apples
Print the value of oranges
💡 Why This Matters
🌍 Real World
Variables let you store data like counts, names, or measurements so your program can use them later.
💼 Career
Understanding variable assignment is a basic skill needed for all programming jobs, including data analysis and software development.
Progress0 / 4 steps
1
Create variable apples with value 10 using <-
Create a variable called apples and assign it the value 10 using the assignment operator <-.
R Programming
Need a hint?

Use apples <- 10 to assign 10 to the variable apples.

2
Create variable oranges with value 5 using =
Create a variable called oranges and assign it the value 5 using the assignment operator =.
R Programming
Need a hint?

Use oranges = 5 to assign 5 to the variable oranges.

3
Print the value of apples
Write a line of code to print the value of the variable apples using the print() function.
R Programming
Need a hint?

Use print(apples) to show the value of apples.

4
Print the value of oranges
Write a line of code to print the value of the variable oranges using the print() function.
R Programming
Need a hint?

Use print(oranges) to show the value of oranges.