Check data format in R
Last Updated :
12 Dec, 2023
In this article, we will discuss how to check the format of the different data in the R Programming Language. we will use the typeof() Function in R.
typeof() Function in R
In R Programming Language The typeof()
function returns the types of data used as the arguments.
Syntax:
typeof(x)
Parameters:
x: specified data
R program to find data types of different values
R
typeof (2)
typeof (5.5)
typeof ( "777" )
typeof ( "gfg" )
typeof (1 + 2i)
|
Output:
[1] "double"
[1] "double"
[1] "character"
[1] "character"
[1] "complex"
R program to find data types of mix values
R
a1<- c (11,22,33, 'GFG' ,55)
typeof (a1)
|
Output:
[1] "character"
R programme to find data types of dataset
R
data (mtcars)
typeof (mtcars)
typeof (mtcars$cyl)
|
Output:
[1] "list"
[1] "double"
To find out the data type is important term in programming it help us to understand that what type of value we have.
typeof() function in R is help us to find out the type of the data easily.
Share your thoughts in the comments
Please Login to comment...