Open In App
Related Articles

Check if the Object is a Data Frame in R Programming – is.data.frame() Function

Improve Article
Improve
Save Article
Save
Like Article
Like

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)

Parameters:
x: specified data.frame

Example 1:




# R program to illustrate
# is.data.frame function
  
# Specifying "Biochemical oxygen demand"
# data set
x <- BOD
  
# Calling is.data.frame() function
is.data.frame(x)


Output:

[1] TRUE

Example 2:




# R program to illustrate
# is.data.frame function
  
# Calling is.data.frame() function 
# over different data types
is.data.frame(4)
is.data.frame("34")
is.data.frame("a")
is.data.frame(2.7)


Output:

[1] FALSE
[1] FALSE
[1] FALSE
[1] FALSE
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 12 Jun, 2020
Like Article
Save Article
Previous
Next
Similar Reads