Psst! Check what courses we have in our offer, and get them all here to save $727. Act fast–this deal is available only 3/14–3/21.
Text values
10. Creating variables


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.


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