Transform a named vector, factor, or list to a 1 or 2 column tibble
Source:R/entibble.R
dot-vector_2_tibble.Rd
Function called in .to_tibble()
.
Arguments
- .in_vec
input data
- .rowname
user specified name for rows
- .vec_name
name for vector, typically an expression
Examples
letters[1:5] |> rlang::set_names() |> .vector_2_tibble()
#> # A tibble: 5 × 2
#> rowname ``
#> <chr> <chr>
#> 1 a a
#> 2 b b
#> 3 c c
#> 4 d d
#> 5 e e
letters[1:5] |> rlang::set_names() |> .vector_2_tibble(.rowname = 'a_name', .vec_name = 'alphas')
#> # A tibble: 5 × 2
#> a_name alphas
#> <chr> <chr>
#> 1 a a
#> 2 b b
#> 3 c c
#> 4 d d
#> 5 e e