read_data: Read simulation data

View source: R/read_data.R

read_dataR Documentation

Read simulation data

Description

Combine data from one simulation, saved as binary files, into a single tibble.

Usage

read_data(root, variables, ncols = rep(1, length(variables)))

Arguments

root

Path to the simulation folder

variables

Vector of names of variable to read (e.g. c("time", "popsize"))

ncols

Vector or list indicating how to split or duplicate each variable when constructing the tibble. There must be one element per variable. See ?sim2tbl for details.

Details

Each variable is read as a vector and reshaped into a tibble by being passed, with its corresponding ncols, to sim2tbl. The resulting tibbles for all variables are then bound together by column.

Value

A tibble containing the simulation data

Note

Do not provide the extension of the data files in variables (".dat").

See Also

sim2tbl

Examples


root <- system.file("extdata", "sim-example", package = "brachypoder")
read_data(root, "time")
read_data(root, c("time", "popsize"))


rscherrer/brachypoder documentation built on Oct. 2, 2024, 11:18 p.m.