
Last chance! 50% off unlimited learning
Sale ends in
Provides dimensions of X
.
size(X, dimen)
Returns object of class size_t
containing the dimensions of
input argument X
if invoked with a single argument. Returns
integer value of specified dimension if invoked with two arguments.
If dimen
specifies a higher dimension than exists, returns 1
representing the singleton dimension.
vector, matrix, or array object
numeric scalar specifies particular dimension
P. Roebuck proebuck1701@gmail.com
This is an S4 generic function.
Vector will be treated as a single row matrix.
Stored value is equivalent to dim
.
size(2:9) # 1 8
size(matrix(1:8, 2, 4)) # 2 4
size(matrix(1:8, 2, 4), 2) # 4
size(matrix(1:8, 2, 4), 3) # 1
Run the code above in your browser using DataLab