doj: Perform data.table calculations within pipe chains

View source: R/jby.R

dojR Documentation

Perform data.table calculations within pipe chains

Description

Perform a data.table calculation dt[,j,by] or dt[,j] within a pipe chain (%>%) .

Usage

jby(data, expr_j, expr_by)

doj(data, expr_j)

Arguments

data

A data.table object, say dt

expr_j

The j expression for dt[,j,by]

expr_by

The by expression for dt[,j,by]

Details

Allows dt[,j,by] or dt[,j] calculations within a pipe chain, such as

iris %>% as.data.table %>% doj(mean(Sepal.Length)) %>% print

Examples

require(data.table); require(dplyr);
iris %>% 
  as.data.table %>% 
  jby(mean(Sepal.Length),Species) %>% 
  print
require(data.table); require(dplyr);
iris %>% 
  as.data.table %>% 
  doj(mean(Sepal.Length)) %>% 
  print

thomasgstewart/tgsify documentation built on Oct. 26, 2024, 8:15 p.m.