% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/add_tables.R
\name{add_exposure_rate_params}
\alias{add_exposure_rate_params}
\title{Add exposure rate simulation data}
\usage{
add_exposure_rate_params(
  GT,
  route = "inhalation",
  params = NULL,
  overwrite = FALSE
)
}
\arguments{
\item{GT}{GeoTox object.}

\item{route}{Exposure route (default "inhalation").}

\item{params}{Data frame with exposure rate parameters. If \code{NULL}, default
parameters for the specified \code{route} will be used (default \code{NULL}).}

\item{overwrite}{Logical indicating whether to overwrite existing exposure
rate parameters for the specified \code{route} (default \code{FALSE}).}
}
\value{
The same GeoTox object, invisibly.
}
\description{
Create or add to the 'exposure_rate_params' table in a GeoTox database.
}
\details{
There are two routes with built-in default exposure rate parameters:
"inhalation" and "drinking". If \code{params} is not provided (\code{NULL}), the
default parameters for the specified \code{route} will be used. If \code{params} is
provided, it must contain columns "age_lb", "age_ub", "mean", and "sd". The
exposure rate parameters are used by \code{\link[=simulate_exposure_rate]{simulate_exposure_rate()}} to generate
exposure rate samples for each individual in the population.

The build-in parameters come from the following sources:
\itemize{
\item Inhalation: \href{https://www.epa.gov/sites/default/files/2015-09/documents/efh-chapter06.pdf}{EPA Exposure Factors Handbook (2015), Table 6.7}
in m\eqn{^3}/kg-day. The "mean" and "sd" values are the average of male and
female values.
\item Drinking: \href{https://www.epa.gov/sites/default/files/2019-02/documents/efh_-_chapter_3_update.pdf}{EPA Exposure Factors Handbook (2019), Table 3-30}
in mL/kg-day.
}
}
\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)
}
\seealso{
\code{\link[=simulate_exposure_rate]{simulate_exposure_rate()}}
}
