Getting class of different data types in R Programming - class() Function Last Updated : 12 Jun, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: Python3 # R program to illustrate # class function # Specifying "Biochemical oxygen demand" # data set x <- BOD x # Calling class() function class(x) 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: Python3 # R program to illustrate # class function # Calling class() function # over different types of data class(2) class(2.8) class("3") class("gfg") class(1 + 2i) Output: [1] "numeric" [1] "numeric" [1] "character" [1] "character" [1] "complex" Comment More infoAdvertise with us Next Article Getting class of different data types in R Programming - class() Function K Kanchan_Ray Follow Improve Article Tags : R Language R Data-types R Object-Function Similar Reads Getting type of different data types in R Programming - typeof() Function typeof() function in R Language is used to return the types of data used as the arguments. Syntax: typeof(x) Parameters: x: specified data Example 1: Python3 # R program to illustrate # typeof function # Specifying "Biochemical oxygen demand" # data set x <- BOD x # Calling typeof() fun 1 min read Generate a set of Sample data from a Data set in R Programming - sample() Function sample() function in R Language creates random sample based on the parameters provided in the function call. It takes either a vector or a positive integer as the object in the function parameter. Syntax: sample(x, size, replace) Parameters: x: indicates either vector or a positive integer or data f 2 min read Check if the Object is a Data Frame in R Programming - is.data.frame() Function is.data.frame() function in R Language is used to return TRUE if the specified data type is a data frame else return FALSE. R data.frame is a powerful data type, especially when processing table (.csv). It can store the data as row and columns according to the table. Syntax: is.data.frame(x) Paramet 1 min read Convert type of data object in R Programming - type.convert() Function type.convert() function in R Language is used to compute the data type of a particular data object. It can convert data object to logical, integer, numeric, or factor. Syntax: type.convert(x) Parameter: x: It can be a vector matrix or an array Example 1: Apply type.convert to vector of numbers Pytho 2 min read Convert an Object to Data Frame in R Programming - as.data.frame() Function as.data.frame() function in R Programming Language is used to convert an object to data frame. These objects can be Vectors, Lists, Matrices, and Factors. Syntax: as.data.frame(object) Parameters:Â object: Vector, Matrix, factor, or data frameR - as.data.frame() Function ExampleExample 1: Basic exam 2 min read Like