Learn R Programming

term (version 0.1.0)

dims: Dimensions of an Object

Description

Gets the dimensions of an object.

Usage

dims(x, ...)

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

# S3 method for data.frame dims(x, ...)

Arguments

x

The object.

...

Unused.

Value

An integer vector of the dimensions.

Methods (by class)

  • default: Dimensions of a default object

  • data.frame: Dimensions of a data frame

Details

Unlike base::dim(), dims works as intuitively expected for vectors and data.frames. A integer vector of the dimensions of a parameter can be converted into the equivalent term-vector() using term().

See Also

base::dim(), term-vector() and term()

Examples

Run this code
# NOT RUN {
dims(character(0))
dims(1:3)
dims(data.frame())
dims(data.frame(x = 1:3))
# }

Run the code above in your browser using DataLab