is.list()
function in R Language is used to return TRUE if the specified data is in the form of list, else returns FALSE.
Syntax: is.list(X)
Parameters:
x: different types of data storage
Example 1:
# R program to illustrate # is.list function # Initializing some list a < - list ( 1 , 2 , 3 )
b < - list (c( "Jan" , "Feb" , "Mar" ))
c < - list (matrix(c( 1 , 2 , 3 , 4 , 5 )))
d < - list ( list ( "green" , 12.3 ))
# Calling is.list() function is . list (a)
is . list (b)
is . list (c)
is . list (d)
|
Output:
[1] TRUE [1] TRUE [1] TRUE [1] TRUE
Example 2:
# R program to illustrate # is.list function # Initializing a data frame "Biochemical Oxygen # Data" data sets x < - BOD
# Each row of the data frame is a list a < - x[ 2 , ]
# Each column of the data frame is not a list b < - x[, 1 ]
# Calling is.list() function is . list (a)
is . list (b)
|
Output:
[1] TRUE [1] FALSE
Article Tags :