% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/set_simulated_css.R
\name{set_simulated_css}
\alias{set_simulated_css}
\title{Set pre-simulated steady-state plasma concentrations}
\usage{
set_simulated_css(GT, df, substance = "casn", overwrite = FALSE)
}
\arguments{
\item{GT}{GeoTox object.}

\item{df}{Data frame containing simulated C\eqn{_{ss}} values for groups of
population characteristics.}

\item{substance}{Column name(s) in \code{df} that contain substance identifier(s)
(default "casn").}

\item{overwrite}{Logical indicating whether to overwrite existing
'simulated_css' table (default FALSE).}
}
\value{
The same GeoTox object, invisibly.
}
\description{
Create the 'simulated_css' table in a GeoTox database, which contains
pre-simulated steady-state plasma concentrations (C\eqn{_{ss}}).
}
\details{
The 'simulated_css' table is used by \code{\link[=sample_simulated_css]{sample_simulated_css()}} to assign
C\eqn{_{ss}} values to individuals. The minimum required columns in the \code{df}
data frame are "age_lb", "age_ub", "weight", "css", and at least one column
with substance information (default "casn").

The values for "age_lb" and "age_ub" should be non-overlapping integers
representing age ranges (in years). For example, two subsequent age groups
might be \code{c(0, 4)} and \code{c(5, 9)}. The "weight" column should contain the
weight category and contain values of either "Normal" or "Obese". The "css"
column should contain the pre-simulated C\eqn{_{ss}} values.

The \code{substance} input can be a named vector to specify multiple substance
identifier columns in \code{df}. For example, \code{c(casn = "casn", name = "chnm")}
would indicate that \code{df} contains both CAS numbers and chemical names for
substances. The \code{name = "chnm"} part would rename the "chnm" column in \code{df}
to "name" in the 'substance' table.
}
\examples{
# Example pre-simulated C_ss data
# Note: normally the css_df would have many more rows for each combination of
# the non-'css' columns to allow for sampling.
css_df <- tibble::tribble(
  ~casn, ~age_lb, ~age_ub, ~weight, ~css,
  "00-00-1",  0, 49, "Normal",  1,
  "00-00-1", 50, 99, "Normal",  2,
  "00-00-1",  0, 49,  "Obese", 11,
  "00-00-1", 50, 99,  "Obese", 12,
  "00-00-2",  0, 49, "Normal", 21,
  "00-00-2", 50, 99, "Normal", 22,
  "00-00-2",  0, 49,  "Obese", 31,
  "00-00-2", 50, 99,  "Obese", 32
)

# Set simulated C_ss values
GT <- GeoTox() |> set_simulated_css(css_df)

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

# Look at relevant tables

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

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

# Clean up example
DBI::dbDisconnect(con)
file.remove(GT$db_info$dbdir)
}
\seealso{
\code{\link[=sample_simulated_css]{sample_simulated_css()}}
}
