In the R programming language, like other languages, variables are given a name and assigned data. Each variable has a name that represents its area in memory. In R, variables are case sensitive, so use care in naming your variables and referring to them later in your code. There are two ways in which this can be done, and both are illustrated in the following screenshot:
Let's take a look at the following ways in which we can use to name a variable and assign data to it:
- In the first code example, a variable named x is created. The use of a less-than sign immediately followed by a dash then follows the variable name. This is the operator used to assign data to a variable in R. On the right-hand side of this operator is the value being assigned to the variable. In this case, the value 10 has been assigned to the variable x. To print the value of a variable in R, you can simple type...