typeof
The Type of an Object
Description
Returns the type or storage mode of any object
Usage
typeof(x)
Arguments
Value
returns a character string. Commonly encountered values are
- "logical"
- "integer"
- "double"
- "complex"
- "character"
- "raw"
- "list"
- "NULL"
These values are identical to the value returned by
storage.mode.
More esoteric values include:
- "pairlist"
- "language"
- "expression"
- "closure"
- "environment"
See Also
Examples
typeof(TRUE) # "logical"
typeof(100L) # "integer"
typeof(100) # "double"
typeof(100+2i) # "complex"
typeof("abc") # "character"
typeof(as.raw(100)) # "raw"
typeof(list()) # "list"
typeof(NULL) # "NULL"
typeof(function(x) x) # "closure"
typeof(.GlobalEnv) # "environment"