Learn R Programming

universals (version 0.0.5)

dims: Dimensions

Description

Gets the dimensions of an object.

Usage

dims(x, ...)

# S3 method for default dims(x, ...)

# S3 method for factor dims(x, ...)

Value

An integer vector of the dimensions.

Arguments

x

An object.

...

Other arguments passed to methods.

Details

Unlike base::dim(), dims returns the length of an atomic vector.

See Also

base::dim()

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

Examples

Run this code
dims(numeric(0))
dims(1:3)
dims(factor("a"))
dims(matrix(1:4, nrow = 2L))
dims(array(1:9, dim = c(3L,1L,3L)))
dims(ToothGrowth)
dims(Titanic)

Run the code above in your browser using DataLab