Introduction
Text values
Variables
10. Creating variables
Functions
Summary

Instruction

You can create your own variables, of course. To do so, type the name of the variable you'd like to create followed by a leftward-pointing arrow (<-), which is referred to as the assignment operator. After the assignment operator, specify the value you'd like to store in the variable, like so:

weight <- 50

You can think of the arrow as telling R where to store the value. The above piece of code assigns the value 50 to a variable named weight.

Exercise

Assign the value 172 (Tanya's height in cm) to a variable named height.