There are eight fundamental data modes in R which are ordered:
1 | logical (TRUE, FALSE, NA) |
2 | numeric (double precision and integer) |
3 | character (character strings) |
4 | complex |
5 | factor |
6 | ordered factor |
7 | list (includes dataframes) |
8 | function |
Use the R function mode to see the mode of an R function. To test if an object x is numeric: is.numeric(x). If x is numeric and you want it complex, you can use as.complex(x). Similar function prefixed by is and as exist for all other modes.