dt: Short cut to data.table

in_dtR Documentation

Short cut to data.table

Description

To use facilities provided by data.table, but do not have to load data.table package.

Usage

in_dt(.data, ...)

as_dt(.data)

Arguments

.data

A data.frame

...

Recieve B in data.table's A[B] syntax.

Details

The as_dt could turn any data frame to data.table class. If the data is not a data frame, return error.

The in_dt function creates a virtual environment in data.table, it could be piped well because it still follows the principals of tidyfst, which are: (1) Never use in place replacement and (2) Always recieves a data frame (data.frame/tibble/data.table) and returns a data.table. Therefore, the in place functions like := will still return the results.

See Also

data.table

Examples

iris %>% as_dt()
iris %>% in_dt(order(-Sepal.Length),.SD[.N],by=Species)

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.