parSim_dt: Parallel Simulator data.table version

View source: R/parSim_dt.R

parSim_dtR Documentation

Parallel Simulator data.table version

Description

The function uses the more efficient data.table in its internal code instead of dplyr, thereby speeding up the function itself and also allowing researchers to use data.table to speed up the code they want to simulate with parSim.

Usage

parSim_dt(
    ...,
    expression,
    reps = 1,
    write = FALSE,
    name,
    nCores = 1,
    export,
    exclude,
    debug = FALSE,
    progressbar = TRUE,
    env = parent.frame()
)

Arguments

...

Any number of R vectors representing the simulation conditions.

expression

An R expression that uses the simulation conditions as variable names. The expression must return a named list or a data.frame.

reps

Integer. The number of replications for each condition. Defaults to 1.

write

Logical, should the results be written to a file instead of returned as a data frame? If TRUE, the name argument must be provided. Defaults to FALSE.

name

Name of the file if write = TRUE. A .txt extension is appended automatically.

nCores

An integer value indicating the number of cores to use for parallel execution. Defaults to 1.

export

A character vector of global objects to export to the cluster.

exclude

A character vector of logical expressions to exclude cases. These are combined with & and evaluated in the context of the simulation design.

debug

Logical. If TRUE, prints iteration details during execution. Defaults to FALSE.

progressbar

Logical. If TRUE, shows a progress bar while running the simulation. Defaults to TRUE.

env

The environment from which to export variables specified in the export argument. Defaults to parent.frame() (i.e., the caller's environment).

Details

The function uses data.table in its internal code instead of dplyr, thereby speeding up the simulation and allowing researchers to use data.table in the code they want to simulate with parSim.

Value

A data.table with the results of each iteration in each row. Returns NULL if write = TRUE.

Author(s)

Xinkai Du <xinkai.du.xd@gmail.com>

See Also

parSim


parSim documentation built on Feb. 26, 2026, 5:06 p.m.