Selecting Variables – Var, Variables=
In SAS and SPSS, selecting variables for an analysis is simple while selecting observations is often much more complicated. In R, these two processes can be almost identical. As a result, variable selection in R is both more flexible and quite a bit more complex. However, since you need to learn that complexity to select observations, it is not much added effort.
Selecting observations in SAS or SPSS requires the use of logical conditions with commands like IF, WHERE, SELECT IF, or FILTER. You do not usually use that logic to select variables. It is possible to do so, through the use of macros or, in the case of SPSS, Python, but it is not a standard approach.
If you have used SAS or SPSS for long, you probably know dozens of ways to select observations, but you did not see them all in the first introductory guide you read. With R, it is best to dive in and see all the methods of selecting variables because understanding them is the key to understanding other documentation, especially...