% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_concentration_mean.R
\name{get_concentration_mean}
\alias{get_concentration_mean}
\title{Get concentration mean values}
\usage{
get_concentration_mean(GT, col)
}
\arguments{
\item{GT}{GeoTox object.}

\item{col}{Column name in the 'concentration' table for which to calculate
the mean, grouped by substance, route, and location.}
}
\value{
A data frame.
}
\description{
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.
}
\details{
The \code{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.
}
\examples{
# 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)
}
