get.strct: Returns the structure of an object

View source: R/get.strct.R

get.strctR Documentation

Returns the structure of an object

Description

Tells you the structure of an object among dataframe, matrix, array, vector, list, function and unknown

Usage

get.strct(obj)

Arguments

obj

The object whose structure you want to get

Value

The returned value is always a string

Author(s)

Chitran Ghosal

Examples

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

Chitran1987/StatsChitran documentation built on Feb. 23, 2025, 8:30 p.m.