vctrs (version 0.0.0.9000)

vec_shape: Compute and alter "shape" of a vector

Description

The shape of a vector is its vec_dim() (i.e. dim() or length()) and whether or not it's a data frame.

Usage

vec_shape(..., data.frame = FALSE)

vec_reshape(x, shape)

Arguments

data.frame

Does this shape represent a data frame? Data frames must be 2 dimensional, and can only be recycled along the first dimension.

x

For shape(), a vector giving dimensions of an object. For as_vec_shape(), an existing data vector

Examples

Run this code
# NOT RUN {
vec_shape(1:10)
vec_shape(1:10, 1)
# }
# NOT RUN {
vec_shape(1:10, 1)
# }
# NOT RUN {
vec_shape(mtcars)
# }

Run the code above in your browser using DataLab