chunk_df: chunk dataframes so easy to split for parallel processing

View source: R/chunk_df.R

chunk_dfR Documentation

chunk dataframes so easy to split for parallel processing

Description

chunk dataframes so easy to split for parallel processing

Usage

chunk_df(.gdf, ..., .nchunks = parallel::detectCores(), .as_list = TRUE)

Arguments

.gdf

(grouped) data frame

...

grouping variables, either a character vector or NSE-style column names

.nchunks

set number of chunks

.as_list

return df as a list

Examples

library(dplyr)
Theoph %>% chunk_df()

Theoph %>% group_by(Subject) %>% chunk_df()
Theoph %>% chunk_df(Subject)
Theoph %>% chunk_df(c("Subject"))

Theoph %>% chunk_df(Subject, .nchunks = 3)

# to retain the df without being a list
Theoph %>% chunk_df(Subject, .nchunks = 3, .as_list = FALSE)

metrumresearchgroup/PKPDmisc documentation built on Oct. 21, 2022, 9:41 a.m.