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)

Parameters:
x: specified data.frame

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

[1] TRUE

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

[1] FALSE
[1] FALSE
[1] FALSE
[1] FALSE
My Personal Notes arrow_drop_up

Recommended Posts:


Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.