Table of Contents
Assignment Operators in R Programming Language: Definition and Usage
Assignment Operators
These operators are used to assign values to vectors.
| Operator | Description | Example |
|---|---|---|
|
<− or = or <<− |
Called Left Assignment |
it produces the following result −
|
|
-> or ->> |
Called Right Assignment |
it produces the following result −
|
More Eamples
The operators <- and = can be used, almost interchangeably, to assign to variable in the same environment.
The <<- operator is used for assigning to variables in the parent environments (more like global assignments). The rightward assignments, although available are rarely used.
> x <- 5
> x
[1] 5
> x = 9
> x
[1] 9
> 10 -> x
> x
[1] 10