In a list of vectors, pad short vectors
padVectors(x, padWith = NA, fieldname_regex_alwaysFlatten = NULL)
Arguments
- x
The list of vectors
- padWith
The element to pad with
- fieldname_regex_alwaysFlatten
A regular expression that,
if it matches one of the names of x
, always causes the corresponding
values to be flattened first.
Value
The list with the padded vectors
Examples
metabefor::padVectors(
list(
c(1, 2, 3),
4,
c(5, 6)
)
);
#> [[1]]
#> [1] 1 2 3
#>
#> [[2]]
#> [1] 4 NA NA
#>
#> [[3]]
#> [1] 5 6 NA
#>