Dim: A more general dimension function

View source: R/NCmisc.R

DimR Documentation

A more general dimension function

Description

A more general 'dim' function. For arrays simply calls the dim() function, but for other data types, tries to provide an equivalent, for instance will call length(x) for vectors, and will recursively report dims for lists, and will attempt something sensible for other datatypes.

Usage

Dim(x, cat.lists = TRUE)

Arguments

x

the object to find the dimension for

cat.lists

logical, for lists, TRUE will concatenate the dimesions to a single string, or FALSE will return the sizes as a list of the same structure as the original.

Value

dimension(s) of the object

See Also

prv, preview

Examples

# create variables of different types to show output styles #
Dim(193)
Dim(1:10)
testvar <- matrix(rnorm(100),nrow=25)
Dim(matrix(rnorm(100),nrow=25))
Dim(list(first="test",second=testvar,third=100:110))
Dim(list(first="test",second=testvar,third=100:110),FALSE)

NCmisc documentation built on Oct. 17, 2022, 5:09 p.m.