Learn R Programming

str2str (version 1.0.0)

undim: Undimension an Object

Description

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.

Usage

undim(x)

Value

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.

Arguments

x

object with dimensions (usually an array of some kind)

Examples

Run this code
a <- array(NA, dim = 1, dimnames = list("A"))
v <- undim(a)
str(a); str(v)

Run the code above in your browser using DataLab