write_simulation: Export a simulation component

View source: R/workflows.R

write_simulationR Documentation

Export a simulation component

Description

Export a simulation component

Usage

write_simulation(x, file, what = "data")

Arguments

x

A simulab_sim simulation result.

file

Destination path. The extension decides the format and must be .csv (written with utils::write.csv(), without row names) or .rds; any other extension is an error.

what

Single string naming the component to write, default "data". Use components(x) to list the choices.

Value

The normalized output path, invisibly.

Examples

result <- simulate_ttest(n_a = 20, n_b = 20, mean_a = 0, mean_b = 0.5, seed = 1)
file <- tempfile(fileext = ".csv")
write_simulation(result, file = file)
head(utils::read.csv(file))
unlink(file)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.