size | R Documentation |
Return the size of a matrix or vector as (Nrows, Ncolumns) Are you tired of getting NULL when you run dim() on a vector?
size(x)
x |
Vector or matrix input |
Integer vector of length 2: c(Nrow, Ncols)
E.D. Gennatas
x <- rnorm(20)
size(x)
# 20 1
x <- matrix(rnorm(100), 20, 5)
size(x)
# 20 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.