ndims: Number of Dimensions

View source: R/ndims.R

ndimsR Documentation

Number of Dimensions

Description

Gets the number of dimensions of an object as returned by dims().

The default methods returns the length of dims().

Usage

ndims(x, ...)

## Default S3 method:
ndims(x, ...)

## S3 method for class 'matrix'
ndims(x, ...)

## S3 method for class 'data.frame'
ndims(x, ...)

Arguments

x

An object.

...

Other arguments passed to methods.

Details

For matrices ndims() is always 2L.

For data frames ndims() is always 2L.

Value

A integer scalar of the number of dimensions.

See Also

Other dimensions: dims(), npdims(), pdims()

Examples

ndims(character(0))
ndims(1:3)
ndims(matrix(1))
ndims(data.frame())
ndims(array(1:9, dim = c(3,1,3)))

universals documentation built on Sept. 22, 2022, 5:07 p.m.