Cast a deb_lsd
or deb_tetra
vector to a list of numeric vectors either
three or four values per list item corresponding to lsd or tetra values.
Usage
deb_as_list(x, ...)
# S3 method for default
deb_as_list(x, ...)
# S3 method for deb_lsd
deb_as_list(x, ...)
# S3 method for deb_tetra
deb_as_list(x, ...)
Arguments
- x
A
deb_lsd
ordeb_tetra
vector to cast to a list of values.- ...
Arguments passed on to further methods.
Details
deb_as_list()
turns a deb_lsd
or deb_tetra
vector into a list of
numeric vectors of length 3 or 4. It is the inverse of deb_as_lsd()
and
deb_as_tetra()
. Compare to as.list()
, which creates a list of deb_lsd
or deb_tetra
vectors or unclass()
, which creates a list of length 3 or
4 with numeric vectors corresponding to the units.
See also
deb_as_lsd()
and deb_as_tetra()
for the inverse of
deb_as_list()
.
Examples
# deb_lsd vector
x <- deb_lsd(l = 0:3, s = 4:7, d = 8:11)
deb_as_list(x)
#> [[1]]
#> [1] 0 4 8
#>
#> [[2]]
#> [1] 1 5 9
#>
#> [[3]]
#> [1] 2 6 10
#>
#> [[4]]
#> [1] 3 7 11
#>
# deb_tetra vector
y <- deb_tetra(l = 0:3, s = 4:7, d = 8:11, f = 1:4)
deb_as_list(y)
#> [[1]]
#> [1] 0 4 8 1
#>
#> [[2]]
#> [1] 1 5 9 2
#>
#> [[3]]
#> [1] 2 6 10 3
#>
#> [[4]]
#> [1] 3 7 11 4
#>
# This is the inverse of `deb_as_lsd()` of a list of lsd values
z <- deb_as_list(x)
identical(x, deb_as_lsd(z))
#> [1] TRUE