tox_data: Prepare ecotox study data for fitting

View source: R/tox_data.R

tox_dataR Documentation

Prepare ecotox study data for fitting

Description

Takes ecotox study data in long-form tabular format and prepares it for parameter fitting. It supports extracting (optional) exposure concentration from tabular data (useful for e.g. studies of acute toxicity) or exposure series can also provided as individual time-series.

Usage

tox_data(data, exposure = NULL)

Arguments

data

a data.frame with at least two and at most four columns; the first column must represent time, the second an observed quantity, the optional third a trial or treatment ID, and the optional fourth the concentration during the experiment

exposure

an optional named list; names must correspond to trial IDs used for the data argument; values can be numeric constants, data.frames, or an ExposureSeries object

Value

a ToxData object

Tabular format

The long-form tabular data must have at least two and at most four columns. The position of the columns define what they represent, the column names are ignored:

  • First column: time

  • Second column: observed quantity, e.g. number of individuals

  • (optional) Third column: Trial or treatment ID

  • (optional) Fourth column: Concentration

The first two columns, time and observed quantity, must always be present. The third column, trial ID, is used to split the table by treatment so that trials can later be handled individually. The fourth column, concentration, can be used to also define the exposure level during the experiments.

Explicit exposure series

As an alternative to defining concentrations along observed data, exposure can also be passed as a list of exposure levels and series with argument exposure. It can be used to provide exposure series for each trial. The following object types are supported to define exposure:

  • Numerical constants

  • Tabular data, e.g. data.frames

  • exposure series objects

If exposure is constant over time, exposure can be defined using a single constant value. More complex exposure time-series can be defined using e.g. data.frames. Tabular data must have two columns with the first column representing time and the second column representing exposure/concentrations.

Examples

library(dplyr)

mydata <- schmitt2013 %>% tox_data()

cvasi documentation built on Sept. 11, 2025, 5:11 p.m.