autokey: Automatically set data.table keys

Description Usage Arguments Details See Also Examples

View source: R/autokey.R

Description

Atomatically sets the keys of a data.table based on options.

Set the column for autokeys

Get the vector of autokeys

Usage

1
2
3
4
5
autokey(x, keys = getOption("datatable.autokey"))

set_autokeys(cols)

autokeys()

Arguments

x

data.table that will get autokeys set.

keys

character; the values to set for keys if present in dt.

autokey sets the keys for a data.table. The default is to look at the getOption('datatable.autokey') for the list available keys. It is equivalent to setting the cols argument of setkeyv equivalent to:

intersect( names(x), getOption('autokey') )

cols

character; column names to be automatically set as keys

This is nothing more than a wrapper for options(autokey=x)

Details

Simple wrapper of getOption('datatable.autokey')

See Also

setkeyv in the data.table package.

Examples

1
2
3
4
  options( autokey='Species' )
  data(iris)
  setDT(iris)
  autokey(iris)

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