View source: R/get_concentration_mean.R
| get_concentration_mean | R Documentation |
Calculates the concentration mean values for each substance and route at each location based on the data in the 'concentration' and 'sample' tables of the GeoTox database. The output of this function is useful for plotting or further analysis.
get_concentration_mean(GT, col)
GT |
GeoTox object. |
col |
Column name in the 'concentration' table for which to calculate the mean, grouped by substance, route, and location. |
The col parameter specifies which column in the 'concentration' table to
use for the mean calculation. The available choices will depend on what data
has been stored in the 'concentration' table during the simulation process.
A data frame.
# Setup required tables
exposure_df <- tibble::tribble(
~FIPS, ~casn, ~route, ~mean, ~sd,
10000, "00-00-1", "inhalation", 10, 1,
10000, "00-00-2", "inhalation", 20, 1,
20000, "00-00-1", "inhalation", 30, 1,
20000, "00-00-2", "inhalation", 40, 1
)
GT <- GeoTox() |>
add_exposure(exposure_df) |>
simulate_exposure(n = 100)
# Calculate mean external concentration by substance and location
get_concentration_mean(GT, "C_ext")
# Open a connection to GeoTox database
con <- get_con(GT)
# Look at column names in the 'concentration' table
dplyr::tbl(con, "concentration") |> 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.