Unlike Java or C#, R enables total flexibility in the assignment of variables. This means that you can assign objects of different types to the same variable. This will cause overriding:
var1 <- 10 var1 <- "a string"
In this case, for instance, R will not throw an error for
var1. In addition, there is no need to pre-declare the class of the variable.
The assignment of variables in R can be done in the following three ways:
<- or ->: These arrows assign the corresponding value to a variable. However, the first alternative is more common:
var1 <- 10 10 -> var1
=: This is similar to
<- or ->.
As in most programming languages, it is important to keep in mind that whenever a comparison is needed,
== must be used.
assign(): This is a function ...