Learn R Programming

vecvec (version 0.1.0)

new_vecvec: Construct a vector of vectors

Description

new_vecvec() constructs a new vector of vectors from a list of vectors. It is meant to be performant, and does not check the inputs for correctness in any way. It is only safe to use after a call to df_list(), which collects and validates the columns used to construct the data frame.

Usage

new_vecvec(x = list(), loc = NULL, class = character())

Value

A vector of vectors of class vecvec.

Arguments

x

An unnamed list of arbitrary vectors.

loc

A named list of value locations, with i identifying the vector index and x identifying the value index. By default, the order of appearance in x will be used.

class

Name of subclass.

Examples

Run this code
# Create a vecvec prototype
new_vecvec()

# Construct a vecvec from a list of vectors
new_vecvec(list(letters, rnorm(10)))

# Fully specify a vecvec with locations
new_vecvec(
  x = list(letters, rnorm(10)),
  loc = list(
    i = c(rep(1L, 3), rep(2L, 5), rep(1L, 23), rep(2L, 5)),
    x = c(1:3, 1:5, 26:4, 6:10)
  )
)

Run the code above in your browser using DataLab