doj: Perform data.table calculations within pipe chains

Description Usage Arguments Details Examples

View source: R/jby.R

Description

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

Usage

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 June 18, 2020, 11:10 a.m.