Getting class of different data types in R Programming – class() Function
Last Updated :
12 Jun, 2020
class()
function in R Language is used to return the class of data used as the arguments.
Syntax: class(x)
Parameters:
x: specified data
Example 1:
Output:
Time demand
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8
[1] "data.frame"
Example 2:
class ( 2 )
class ( 2.8 )
class ( "3" )
class ( "gfg" )
class ( 1 + 2i )
|
Output:
[1] "numeric"
[1] "numeric"
[1] "character"
[1] "character"
[1] "complex"
Share your thoughts in the comments
Please Login to comment...