
上QQ阅读APP看书,第一时间看更新
Variable
Just before digging any deeper, we need to know how to assign values to any variable. So, what is a variable? It's like a container, which holds different value(s) of different types (or the same type). When assigning multiple values to any variable, we write the variable name to the left, followed by an <- or = and then the value. So, if we want to assign 2 to a variable x, we can write either of the two:
x <- 2
or
x = 2
I find the latter convenient, although the R community prefers to use the former – my suggestion is to use one which you find more convenient.