R: Converting atomic vectors to data frames, and vice versa

enframe {tibble} | R Documentation

## Converting atomic vectors to data frames, and vice versa

### Description

`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.

### Usage

    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)
    enframe(c(a = 5, b = 7))

[Package tibble version 1.3.0 Index]