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.

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

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.

Value

A vector of vectors of class vecvec.

Examples

# Create a vecvec prototype
new_vecvec()
#> <vecvec[0]>

# Construct a vecvec from a list of vectors
new_vecvec(list(letters, rnorm(10)))
#> <vecvec[36]>
#>  [1] a            b            c            d            e           
#>  [6] f            g            h            i            j           
#> [11] k            l            m            n            o           
#> [16] p            q            r            s            t           
#> [21] u            v            w            x            y           
#> [26] z             0.255317055 -2.437263611 -0.005571287  0.621552721
#> [31]  1.148411606 -1.821817661 -0.247325302 -0.244199607 -0.282705449
#> [36] -0.553699384

# 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)
  )
)
#> <vecvec[36]>
#>  [1] a           b           c            0.62898204  2.06502490 -1.63098940
#>  [7]  0.51242695 -1.86301149 z           y           x           w          
#> [13] v           u           t           s           r           q          
#> [19] p           o           n           m           l           k          
#> [25] j           i           h           g           f           e          
#> [31] d           -0.52201251 -0.05260191  0.54299634 -0.91407483  0.46815442