lifeTable_calculate: Batch Analysis of Life Table Data

View source: R/lifetable_calculate.R

lifeTable_calculateR Documentation

Batch Analysis of Life Table Data

Description

Runs the complete workflow (reading, validation, calculation, plotting and exporting) for every csv file in a folder, or for a single csv file. Each data set gets its own 'Excel' workbook; in addition an all.xlsx with the summary of all files is created. Files that fail (e.g. because of data errors) are skipped and reported at the end without interrupting the remaining files.

Usage

lifeTable_calculate(
  path,
  output_path = NULL,
  plot = TRUE,
  keep_tiff = FALSE,
  dpi = 300,
  bootstrap = FALSE,
  B = 1e+05,
  seed = NULL
)

Arguments

path

Character; the data path: a folder (all csv files inside are analysed) or a single csv file. The type of the path is determined by check_path_type().

output_path

Character; the export folder. Defaults to the parent folder of the csv file (single-file mode) or the data folder itself (folder mode).

plot

Logical; whether the age-stage survival curves are generated and embedded into the workbooks (default TRUE).

keep_tiff

Logical; whether to keep the standalone tiff files (default FALSE).

dpi

Numeric; resolution of the exported images (default 300).

bootstrap

Logical; whether to estimate the standard errors and percentile confidence intervals of all scalar parameters of every file with lifeTable_bootstrap (default FALSE). Each workbook then contains an extra worksheet with the bootstrap results and the summary workbook all.xlsx gains one _SE column per population parameter.

B

Integer; number of bootstrap replicates per file (only used when bootstrap = TRUE). The TWOSEX-MSChart standard is 100000 (the default).

seed

Integer; base seed of the bootstrap random number generator (only used when bootstrap = TRUE); file p is analysed with seed seed + p. NULL uses the current R session state.

Value

A summary data frame with one row per successfully analysed file (population parameters as columns, plus their bootstrap standard errors as _SE columns when bootstrap = TRUE); the attribute error_files contains the names of the files that failed.

See Also

lifeTable_read, lifeTable_calculate_all, lifeTable_bootstrap, lifeTable_plot, lifeTable_export

Examples

f <- system.file("extdata", "lifetable_example.csv", package = "insectecol")
lifeTable_calculate(f, output_path = file.path(tempdir(), "insectecol-demo"))

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