Find Data Type of an Object in R
To find the data type of an object you have to use class() function. The syntax for doing that is you need to pass the object as an argument to the function class() to find the data type of an object.
Syntax
class(object)
Example
R
# A simple R program # to find data type of an object # Logical print ( class ( TRUE )) # Integer print ( class (3L)) # Numeric print ( class (10.5)) # Complex print ( class (1+2i)) # Character print ( class ( "12-04-2020" )) |
Output
[1] "logical" [1] "integer" [1] "numeric" [1] "complex" [1] "character"
R Data Types
Different forms of data that can be saved and manipulated are defined and categorized using data types in computer languages, including R. Each R data type has unique properties and associated operations.