drop
Drop Length One Dimensions of an Array
Description
Returns an array or a vector, deleting dimensions that have only one level (dead dimensions).
Usage
drop(x)
Arguments
x |
any object, but anything other than a matrix or array is simply returned unchanged.
|
Details
Dead dimensions are dropped automatically when
arrays are subscripted, unless you use drop=FALSE. (See Subscript).
Value
returns an array with the same values as x, except that dead dimensions are dropped.
That is, all ones in dim(x) are deleted, and dimnames(x)
is adjusted appropriately.
Returns a vector if all dimensions are dropped, or if x has no dimensions.
See Also
Examples
# if x is an n by 1 matrix, with n large, you
# can look at it more easily with
x <- matrix(1:10)
drop(x)