Skip to content

Commit

Permalink
Updated dataset (#49)
Browse files Browse the repository at this point in the history
* Updated package dataset

* Save processed exposure to data-raw
  • Loading branch information
SkylarMarvel authored Aug 2, 2024
1 parent 3715ebb commit 84984de
Show file tree
Hide file tree
Showing 15 changed files with 23,158 additions and 295 deletions.
2 changes: 1 addition & 1 deletion R/GeoTox.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GeoTox <- function() {
exposure = list(
expos_mean = "mean",
expos_sd = "sd",
expos_label = "CASRN"
expos_label = "casn"
),
internal_dose = list(
time = 1,
Expand Down
2 changes: 1 addition & 1 deletion R/calc_concentration_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ calc_concentration_response <- function(C_invitro,
tp_i <- tp[i, ]
AC50_i <- 10^logAC50[i, ]

if (all(C_i == 0)) {
if (all(is.na(C_i) | C_i == 0)) {
GCA.eff[i] <- IA.eff[i] <- GCA.HQ.10[i] <- IA.HQ.10[i] <- NA
next
} else {
Expand Down
21 changes: 11 additions & 10 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#' GeoTox data
#' GeoTox Data
#'
#' Sample data for use in vignettes and function examples. See the
#' "package_data" vignette for details on how this data was gathered.
#' Sample data for use in vignettes and function examples. See the Package
#' Data vignette, \code{vignette("package_data", package = "GeoTox")}, for
#' details on how this data was gathered.
#'
#' @format A list with items:
#' \describe{
#' \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}
#' chemicals in North Carolina counties.}
#' \item{dose_response}{Subset of chemicals curated by ICE cHTS as active
#' within a set of assays.}
#' \item{age}{County population estimates for 7/1/2019 in North Carolina.}
#' \item{obesity}{CDC PLACES obesity data for North Carolina counties in
#' 2020}
#' 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}
#' various age groups and obesity status combinations.}
#' \item{boundaries}{County and state boundaries for North Carolina in 2019.}
#' }
"geo_tox_data"
10 changes: 5 additions & 5 deletions R/simulate_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
#'
#' @examples
#' # Single data frame
#' x <- data.frame(mean = 1:3, sd = (1:3) / 10, CASRN = letters[1:3])
#' x <- data.frame(mean = 1:3, sd = (1:3) / 10, casn = letters[1:3])
#' simulate_exposure(x, n = 5)
#'
#' # List of 2 data frames
#' y <- data.frame(mean = 4:6, sd = 0.1, CASRN = letters[1:3])
#' y <- data.frame(mean = 4:6, sd = 0.1, casn = letters[1:3])
#' simulate_exposure(list(loc1 = x, loc2 = y), n = 5)
#'
#' # Input has custom column names
#' z <- data.frame(ave = 1:3, stdev = (1:3) / 10, chem = letters[1:3])
#' z <- data.frame(ave = 1:3, stdev = (1:3) / 10, chnm = letters[1:3])
#' simulate_exposure(z,
#' expos_mean = "ave",
#' expos_sd = "stdev",
#' expos_label = "chem",
#' expos_label = "chnm",
#' n = 5)
#'
#' @export
simulate_exposure <- function(x,
expos_mean = "mean",
expos_sd = "sd",
expos_label = "CASRN",
expos_label = "casn",
n = 1e3) {

if (!any(c("data.frame", "list") %in% class(x))) {
Expand Down
Loading

0 comments on commit 84984de

Please sign in to comment.