add_exposure_rate_params: Add exposure rate simulation data

View source: R/add_tables.R

add_exposure_rate_paramsR Documentation

Add exposure rate simulation data

Description

Create or add to the 'exposure_rate_params' table in a GeoTox database.

Usage

add_exposure_rate_params(
  GT,
  route = "inhalation",
  params = NULL,
  overwrite = FALSE
)

Arguments

GT

GeoTox object.

route

Exposure route (default "inhalation").

params

Data frame with exposure rate parameters. If NULL, default parameters for the specified route will be used (default NULL).

overwrite

Logical indicating whether to overwrite existing exposure rate parameters for the specified route (default FALSE).

Details

There are two routes with built-in default exposure rate parameters: "inhalation" and "drinking". If params is not provided (NULL), the default parameters for the specified route will be used. If params is provided, it must contain columns "age_lb", "age_ub", "mean", and "sd". The exposure rate parameters are used by simulate_exposure_rate() to generate exposure rate samples for each individual in the population.

The build-in parameters come from the following sources:

Value

The same GeoTox object, invisibly.

See Also

simulate_exposure_rate()

Examples

# Add both default params to GeoTox database
GT <- GeoTox() |>
  add_exposure_rate_params() |>
  add_exposure_rate_params(route = "drinking")

# Open a connection to GeoTox database
con <- get_con(GT)

# Look at relevant tables
params_tbl <- dplyr::tbl(con, "exposure_rate_params") |> dplyr::collect()

params_tbl |> dplyr::filter(route_id == 1)

params_tbl |> dplyr::filter(route_id == 2)

dplyr::tbl(con, "route") |> dplyr::collect()

# Add custom params with new column (gender), assign to route "custom"
params_df <- tibble::tribble(
  ~age_lb, ~age_ub, ~gender, ~mean, ~sd,
   0, 49, "male",   10, 1,
  50, 99, "male",   20, 1,
   0, 49, "female", 30, 1,
  50, 99, "female", 40, 1
)
GT |> add_exposure_rate_params(params_df, route = "custom")

# Look at updated tables
params_tbl <- dplyr::tbl(con, "exposure_rate_params") |> dplyr::collect()

params_tbl |> dplyr::filter(route_id == 1)

params_tbl |> dplyr::filter(route_id == 2)

params_tbl |> dplyr::filter(route_id == 3)

dplyr::tbl(con, "route") |> dplyr::collect()

# Clean up example
DBI::dbDisconnect(con)
file.remove(GT$db_info$dbdir)

GeoTox documentation built on May 20, 2026, 1:07 a.m.