split_dt: Split a data.table into groups of similar length

Description Usage Arguments Examples

View source: R/split_dt.R

Description

Split a data.table into groups of similar length

Usage

1
split_dt(.Data, .n = NULL, .size = NULL)

Arguments

.Data

A data.table.

.n

Integer scalar. Number of groups.

.size

Integer scalar. Number of observations per group.

Examples

1
2
3
4
5
6
library(data.table)
x <- split_dt(iris %>% as.data.table, 7)
lapply(x, NROW)

x <- split_dt(iris %>% as.data.table, .size = 50)
lapply(x, NROW)

markusdumke/fluid documentation built on Sept. 24, 2019, 11 p.m.