In the R official docs, the term ''variable'' is used to describe two distinct things:
The name we give to any type of object with the
<-
operator or withassign
For instance, we could say that in
a <- data.frame(0)
, a is a variable, i.e. a symbol that links that particular dataframe to it.A vector or a factor, belonging or not to a structure like a matrix or a dataframe, and containing units of data which, we assume, can take any of several or many values.
In this case it's akin to the statistical version of the term, such as in ''random variable''.
So my question is the following:
How do I help students understand the difference between programmatic and statistical usage of the term variable
when teaching R?
(thanks and credits to @Gregor who formulated it in a better way than I would.)