Check if an Object is a Table in R Programming – is.table() Function
Last Updated :
19 Jun, 2020
is.table()
function in R Language is used to check if an object is a table.
Syntax: is.table(x)
Parameters:
x: Object to be checked
Example 1:
vec = c( 2 , 4 , 3 , 1 , 2 , 3 , 2 , 1 , 4 , 2 )
is .table(vec)
x < - as.table(vec)
x
is .table(x)
|
Output:
[1] FALSE
A B C D E F G H I J
2 4 3 1 2 3 2 1 4 2
[1] TRUE
Example 2:
mat = matrix(c( 1 : 9 ), 3 , 3 )
is .table(mat)
x < - as.table(mat)
x
is .table(x)
|
Output:
[1] FALSE
A B C
A 1 4 7
B 2 5 8
C 3 6 9
[1] TRUE
Share your thoughts in the comments
Please Login to comment...