Learn R Programming

R.oo (version 1.26.0)

dimension: Gets the dimension of the object

Description

Gets the dimension of the object similar to what dim() does, but instead of NULL it will return the length of a vector. If a function is passed, NULL is returned.

Usage

# S3 method for default
dimension(object, ...)

Value

Returns an integer

vector or NULL.

Arguments

object

The object for which the dimension should be obtained.

...

Not used.

Author

Henrik Bengtsson

See Also

ll.default(). dim() and length().

Examples

Run this code
  dimension(matrix(1:100, ncol=10))     # 10 10
  dimension(1:14)                       # 14
  dimension(data.frame(a=1:10, b=10:1)) # 10  2
  dimension(print)                      # NULL

Run the code above in your browser using DataLab