Variable assignment II
Variables are great to perform arithmetic operations with. In this assignment, we have defined a variable my_apples
. You want to define another variable called my_oranges
and add these two together.
my_apples + my_oranges
This exercise is part of the course
Inferential Statistics
Exercise instructions
- Create a variable called
my_oranges
and assign it the value of 6. - Add the variables
my_apples
andmy_oranges
and have R simply print the result. - Combine the variables
my_apples
andmy_oranges
into a new variablemy_fruit
, which is the total amount of fruits in your fruit basket.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Assign a value to the variables my_apples and my_oranges
my_apples <- 5
# Add these two variables together and print the result
# Create the variable my_fruit