So far, we’ve run some calculations and assigned some variables. In this chapter, we’ll find out ways to examine the properties of those variables and to manipulate the user workspace that contains them.
After reading this chapter, you should:
All variables in R have a class, which tells you what kinds of variables they are. For example, most numbers have class
numeric (see the next section for the other types), and logical values have class
logical. Actually, being picky about it, vectors of numbers are
numeric and vectors of logical values are
logical, since R has no scalar types. The “smallest” data type in R is a vector.
You can find out what the class of a variable is using
##  "logical"
It’s worth being aware that as well as a class, all variables also have an internal storage type (accessed via
typeof), a mode (see
mode), and a storage mode (
storage.mode). If this sounds complicated, don’t worry! Types, modes, and storage modes mostly exist for legacy purposes, so in practice you should only ever need to use an object’s
class (at least until you join the R Core Team). Appendix A has a reference table showing the relationships between class, ...