enframe() converts named atomic vectors or lists to two-column data frames. For unnamed vectors, the natural sequence is used as name column. deframe() converts two-column data frames to a named vector or list, using the first column as name and the second column as value.

enframe(x, name = "name", value = "value")

deframe(x)

Arguments

x

An atomic vector (for enframe()) or a data frame (for deframe())

name, value

Names of the columns that store the names and values

Value

A tibble

Examples

enframe(1:3)
#> # A tibble: 3 × 2 #> name value #> <int> <int> #> 1 1 1 #> 2 2 2 #> 3 3 3
enframe(c(a = 5, b = 7))
#> # A tibble: 2 × 2 #> name value #> <chr> <dbl> #> 1 a 5 #> 2 b 7