get.strct | R Documentation |
Tells you the structure of an object among dataframe, matrix, array, vector, list, function and unknown
get.strct(obj)
obj |
The object whose structure you want to get |
The returned value is always a string
Chitran Ghosal
#build function
dumm <- function(X){
return(X)
}
#build other data-types and put them in a list
L <- list(vec = c(1, 2, 3, 4))
L$matrix <- matrix(data = L$vec, nrow = 2, byrow = T)
L$dataframe <- data.frame(L$matrix)
L$array <- array(seq(1, 60), dim = c(2, 2, 3, 5))
L$list <- L
L$func <- dumm
#loop through the list to see the outputs
for(i in 1:length(L)){
print(get.strct(L[[i]]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.