Learn R Programming

Zelig (version 3.5.5)

dims: Return Dimensions of Vectors, Arrays, and Data Frames

Description

Retrieve the dimensions of a vector, array, or data frame.

Usage

dims(x)

Arguments

x
An R object. For example, a vector, matrix, array, or data frame.

Value

  • The function dims performs exactly the same as dim, and additionally returns the length of vectors (treating them as one-dimensional arrays).

See Also

dim, length

Examples

Run this code
a <- 1:12
dims(a)

a <- matrix(1, nrow = 4, ncol = 9)
dims(a)

Run the code above in your browser using DataLab