params <- list(my_css = "css/rmdformats.css") ## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(httptest) library(data.table) start_vignette("5") ## ----setup, echo=FALSE, message=FALSE, warning=FALSE-------------------------- #if (!library(ctxR, logical.return = TRUE)){ devtools::load_all() #} old_options <- options("width") ## ----setup-print, echo = FALSE------------------------------------------------ # Redefining the knit_print method to truncate character values to 25 characters # in each column and to truncate the columns in the print call to prevent # wrapping tables with several columns. #library(ctxR) knit_print.data.table = function(x, ...) { y <- data.table::copy(x) y <- y[, lapply(.SD, function(t){ if (is.character(t)){ t <- strtrim(t, 25) } return(t) })] print(y, trunc.cols = TRUE) } registerS3method( "knit_print", "data.table", knit_print.data.table, envir = asNamespace("knitr") ) ## ----exposure functional use-------------------------------------------------- exp_fun_use <- get_exposure_functional_use(DTXSID = 'DTXSID7020182') ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_fun_use)) %>% kableExtra::kable_styling("striped") %>% kableExtra::scroll_box(width = "100%") ## ----------------------------------------------------------------------------- exp_fun_use_prob <- get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182') ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_fun_use_prob)) ## ----------------------------------------------------------------------------- bpa_prob <- get_exposure_functional_use_probability(DTXSID = 'DTXSID7020182') caf_prob <- get_exposure_functional_use_probability(DTXSID = 'DTXSID0020232') bpa_caf_prob <- get_exposure_functional_use_probability_batch(DTXSID = c('DTXSID7020182', 'DTXSID0020232')) ## ----echo=FALSE--------------------------------------------------------------- bpa_prob ## ----echo=FALSE--------------------------------------------------------------- caf_prob ## ----echo=FALSE--------------------------------------------------------------- bpa_caf_prob ## ----------------------------------------------------------------------------- exp_fun_use_cat <- get_exposure_functional_use_category() ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_fun_use_cat)) ## ----------------------------------------------------------------------------- exp_prod_dat <- get_exposure_product_data(DTXSID = 'DTXSID7020182') ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_prod_dat))%>% kableExtra::kable_styling("striped") %>% kableExtra::scroll_box(width = "100%") ## ----------------------------------------------------------------------------- exp_prod_data_puc <- get_exposure_product_data_puc() ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_prod_data_puc)) ## ----------------------------------------------------------------------------- bpa_httk <- get_httk_data(DTXSID = 'DTXSID7020182') head(data.table(bpa_httk)) ## ----------------------------------------------------------------------------- exp_list_tags <- get_exposure_list_presence_tags() ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_list_tags)) ## ----------------------------------------------------------------------------- exp_list_tags_dat <- get_exposure_list_presence_tags_by_dtxsid(DTXSID = 'DTXSID7020182') ## ----echo=FALSE--------------------------------------------------------------- knitr::kable(head(exp_list_tags_dat))%>% kableExtra::kable_styling("striped") %>% kableExtra::scroll_box(width = "100%") ## ----------------------------------------------------------------------------- bpa_general_exposure <- get_general_exposure_prediction(DTXSID = 'DTXSID7020182') head(bpa_general_exposure) ## ----------------------------------------------------------------------------- bpa_demographic_exposure <- get_demographic_exposure_prediction(DTXSID = 'DTXSID7020182') head(data.table(bpa_demographic_exposure)) ## ----------------------------------------------------------------------------- # Caffeine product use categories caffeine_product_use <- get_product_use_category('DTXSID0020232') head(data.table(caffeine_product_use)) ## ----------------------------------------------------------------------------- # Caffeine production volume caffeine_prod_vol <- get_production_volume('DTXSID0020232') data.table(caffeine_prod_vol) ## ----------------------------------------------------------------------------- # BPA biomonitoring data bpa_biom <- get_biomonitoring_data('DTXSID7020182') head(data.table(bpa_biom)) ## ----------------------------------------------------------------------------- # BPA general use keywords bpa_gen_use <- get_general_use_keywords('DTXSID7020182') head(data.table(bpa_gen_use)) ## ----------------------------------------------------------------------------- # BPA reported functional use bpa_reported_use <- get_reported_functional_use('DTXSID7020182') head(data.table(bpa_reported_use)) ## ----------------------------------------------------------------------------- # BPA chemical weight fractions bpa_weight_fractions <- get_chemical_weight_fraction('DTXSID7020182') head(data.table(bpa_weight_fractions)) ## ----------------------------------------------------------------------------- medium_categories <- get_medium_categories() head(medium_categories) ## ----------------------------------------------------------------------------- # Data on methylphenanthrene methylphenanthrene <- get_single_sample_records_by_dtxsid(DTXSID = 'DTXSID001025673') head(data.table(methylphenanthrene)) # Data from soil indoor_air <- get_single_sample_records_by_medium(Medium = 'indoor air') head(data.table(indoor_air$data)) ## ----------------------------------------------------------------------------- # Data on caffeine caffeine_agg <- get_aggregate_records_by_dtxsid(DTXSID = 'DTXSID0020232') head(data.table(caffeine_agg)) # Data from soil indoor_air_agg <- get_aggregate_records_by_medium(Medium = 'indoor air') head(data.table(indoor_air_agg$data)) ## ----breakdown, echo = FALSE, results = 'hide'-------------------------------- # This chunk will be hidden in the final product. It serves to undo defining the # custom print function to prevent unexpected behavior after this module during # the final knitting process and restores original option values. knit_print.data.table = knitr::normal_print registerS3method( "knit_print", "data.table", knit_print.data.table, envir = asNamespace("knitr") ) options(old_options) ## ----include=FALSE------------------------------------------------------------ end_vignette()