View source: R/set_simulated_css.R
| set_simulated_css | R Documentation |
Create the 'simulated_css' table in a GeoTox database, which contains
pre-simulated steady-state plasma concentrations (C_{ss}).
set_simulated_css(GT, df, substance = "casn", overwrite = FALSE)
GT |
GeoTox object. |
df |
Data frame containing simulated C |
substance |
Column name(s) in |
overwrite |
Logical indicating whether to overwrite existing 'simulated_css' table (default FALSE). |
The 'simulated_css' table is used by sample_simulated_css() to assign
C_{ss} values to individuals. The minimum required columns in the 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 c(0, 4) and 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_{ss} values.
The substance input can be a named vector to specify multiple substance
identifier columns in df. For example, c(casn = "casn", name = "chnm")
would indicate that df contains both CAS numbers and chemical names for
substances. The name = "chnm" part would rename the "chnm" column in df
to "name" in the 'substance' table.
The same GeoTox object, invisibly.
sample_simulated_css()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.