textshape (version 1.7.5)

tidy_vector: Tidy a Named Atomic Vector: Bind Its Values with Its Names

Description

cbind a named atomic vector's values with its names to form id (from the names) and content columns.

Usage

tidy_vector(x, id.name = "id", content.name = "content", ...)

Value

Returns a data.table with the names

from the vector as an id column.

Arguments

x

A named atomic vector.

id.name

The name to use for the column created from the vector names.

content.name

The name to use for the column created from the vector values.

...

ignored.

Examples

Run this code
x <- setNames(sample(LETTERS[1:6], 1000, TRUE), sample(state.name[1:5], 1000, TRUE))
tidy_vector(x)

Run the code above in your browser using DataLab