-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Function wrappers, new package data, new vignettes (#32)
* Function wrappers, new package data, new vignettes * More merge changes
- Loading branch information
1 parent
f9fca8e
commit 4379f9f
Showing
36 changed files
with
1,493 additions
and
1,371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
/*.Rcheck/ | ||
|
||
# RStudio files | ||
*.Rproj | ||
.Rproj.user/ | ||
|
||
# produced vignettes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,53 @@ | ||
#' Calculate internal chemical dose | ||
#' | ||
#' @description | ||
#' Estimate the internal dose from inhalation of a chemical given inhalation rate, time, and body weight | ||
#' Estimate the internal dose from inhalation of a chemical given inhalation | ||
#' rate, time, and body weight | ||
#' | ||
#' @param C_ext ambient chemical concentration in \eqn{\frac{mg}{m^3}} | ||
#' @param IR inhalation rate in \eqn{\frac{m^3}{day}} | ||
#' @param time total time in \eqn{days} | ||
#' @param BW body weight in \eqn{kg} | ||
#' @param scaling scaling factor encompassing any required unit adjustments | ||
#' | ||
#' @details | ||
#' TODO Additional details... | ||
#' \deqn{D_{int} = \frac{C_{ext} \,\times\, IR \,\times\, time}{BW}} | ||
#' | ||
#' @return internal chemical dose in \eqn{\frac{mg}{kg}} | ||
#' | ||
#' @examples | ||
#' n_chem <- 3 | ||
#' n_sample <- 5 | ||
#' | ||
#' # Single population | ||
#' C_ext <- matrix(runif(n_sample * n_chem), ncol = n_chem) | ||
#' IR <- runif(n_sample) | ||
#' calc_internal_dose(C_ext, IR) | ||
#' | ||
#' # Multiple populations | ||
#' C_ext <- list( | ||
#' "a" = matrix(runif(n_sample * n_chem), ncol = n_chem), | ||
#' "b" = matrix(runif(n_sample * n_chem), ncol = n_chem) | ||
#' ) | ||
#' IR <- list(runif(n_sample), runif(n_sample)) | ||
#' calc_internal_dose(C_ext, IR) | ||
#' | ||
#' @export | ||
calc_internal_dose <- function(C_ext, IR, time = 1, BW = 1) { | ||
calc_internal_dose <- function(C_ext, IR, time = 1, BW = 1, scaling = 1) { | ||
# TODO How to handle inputs with different units? | ||
# e.g. simulated inhalation rate is in m^3/(day * kg), so BW isn't needed | ||
# TODO paper states t = 365 in section 2.3, also states that C_ss achieved | ||
# in 1 day and repeated exposure accumulates additively. Computation done | ||
# with t = 1, is that correct? | ||
C_ext * IR * time / BW | ||
|
||
if (methods::is(C_ext, "matrix")) { | ||
.calc_internal_dose(C_ext, IR, time, BW, scaling) | ||
} else { | ||
mapply(.calc_internal_dose, C_ext, IR, time, BW, scaling, SIMPLIFY = FALSE) | ||
} | ||
} | ||
|
||
.calc_internal_dose <- function(C_ext, IR, time, BW, scaling) { | ||
C_ext * IR * time / BW * scaling | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
#' Geo Tox data | ||
#' | ||
#' A subset of data from the GeoToxMIE source scripts | ||
#' Sample data for use in vignettes and function examples. See the | ||
#' "package_data" vignette for details on how this data was gathered. | ||
#' | ||
#' @format A list with 4 items: | ||
#' @format A list with items: | ||
#' \describe{ | ||
#' \item{ice}{Description} | ||
#' \item{MC_iter}{Description} | ||
#' \item{cyp1a1}{Description} | ||
#' \item{age}{Description} | ||
#' \item{Css}{Description} | ||
#' } | ||
#' Css is a list with 5 items: | ||
#' \describe{ | ||
#' \item{Css$age}{Description} | ||
#' \item{Css$obesity}{Description} | ||
#' \item{Css$httk}{Description} | ||
#' \item{Css$'dose-resp'}{Description} | ||
#' \item{Css$'ext-conc'}{Description} | ||
#' \item{exposure}{2019 AirToxScreen exposure concentrations for a subset of | ||
#' chemicals in North Carolina counties} | ||
#' \item{dose_response}{A subset of data from InvitroDB for the | ||
#' "LTEA_HepaRG_CYP1A1_up" assay} | ||
#' \item{age}{County population estimates for 7/1/2019 in North Carolina} | ||
#' \item{obesity}{CDC PLACES obesity data for North Carolina counties in | ||
#' 2020} | ||
#' \item{simulated_css}{Simulated steady-state plasma concentrations for | ||
#' various age groups and obesity status combinations} | ||
#' \item{boundaries}{County and state boundaries for North Carolina in 2019} | ||
#' } | ||
"geo_tox_data" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.