entable: Convert vectors to data tables and vice versa

Description Usage Arguments Details Value See Also Examples

View source: R/entable.R

Description

Convert vectors to data tables and vice versa

Usage

1
entable(x, key = ".key", value = as.character(substitute(x)))

Arguments

x

atomic vector

key, value

Names of the columns that store the keys and values.

Details

entable converts a data.table from an atomic vector. The vector becomes a table column named value which, by default, is named after x.

If the vector is named, a two-column data table is produced. The first column is the names of x and is named by the key argument. The key defaults to .key.

A key is created for the first column.

Value

A one or two column data.table with a key on the first column.

See Also

Examples

1
2
3
4
5
  x = 1:3
  entable(x)
  names(x) <- letters[x]
  entable(x)
  entable(x, key="letter")

decisionpatterns/data.table.plus documentation built on June 15, 2020, 10:26 p.m.