Converts named and unnamed vectors to a data.table/tidytable.
enframe(x, name = "name", value = "value")
A vector
Name of the column that stores the names. If name = NULL
,
a one-column tidytable will be returned.
Name of the column that stores the values.
vec <- 1:3
names(vec) <- letters[1:3]
enframe(vec)
#> # A tidytable: 3 × 2
#> name value
#> <chr> <int>
#> 1 a 1
#> 2 b 2
#> 3 c 3