View source: R/str2str_functions.R
undim | R Documentation |
undim
removes all dimensions from an object. This is particularly useful
for simplifying 1D arrays where the dimnames from the array are used for the
returned object. Although the function can also be used when dimensions were
temporarily (or erroneously) given to an object.
undim(x)
x |
object with dimensions (usually an array of some kind) |
x
without any dimensions. If x
is an array, then the return
object will be an atomic vector. If x
is a 1D array, then the returned
vector will have names = the 1D dimnames.
a <- array(NA, dim = 1, dimnames = list("A"))
v <- undim(a)
str(a); str(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.