Skip to contents

Up until version 1.3.1, toxEval only required “CAS” and “Class” in the Chemicals tab of the data (see vignette("PrepareData", package = "toxEval"). In those previous versions of toxEval, the chemical names were taken from the Substance_Name in the included data frame . The information in that table (including substance name) come from the ToxCast database.

Many users are using toxEval for user-curated benchmarks workflows, and the auto-generated chemical names became difficult to work with. So going forward from version 1.3.1, the chemical names seen in tables and figures come from the “Chemical” tab.

To get the pre-1.3.1 names, use a join. We’ll open the example data, delete the pre-defined column of chemical names, and show how to do a join using tox_chemicals.

library(toxEval)
library(dplyr)
path_to_tox <- system.file("extdata", package = "toxEval")
file_name <- "OWC_data_fromSup.xlsx"

full_path <- file.path(path_to_tox, file_name)

chem_info <- readxl::read_xlsx(full_path, sheet = "Chemicals")

#remove Chemical column for demonstration:
chem_info <- chem_info[, c("CAS", "Class")]

tox_chemicals <- tox_chemicals

chem_info_with_names <- chem_info %>%
  left_join(select(tox_chemicals,
                   CAS = casn,
                   Chemical = chnm),
            by = "CAS")

head(chem_info_with_names)
## # A tibble: 6 × 3
##   CAS       Class           Chemical                          
##   <chr>     <chr>           <chr>                             
## 1 121-00-6  Antioxidants    2-tert-Butyl-4-methoxyphenol      
## 2 136-85-6  Antioxidants    5-Methyl-1H-benzotriazole         
## 3 80-05-7   Antioxidants    Bisphenol A                       
## 4 84-65-1   Dyes/Pigments   Anthraquinone                     
## 5 5436-43-1 Fire Retardants 2,2',4,4'-Tetrabromodiphenyl ether
## 6 126-73-8  Fire Retardants Tributyl phosphate

Users need to supply their own names for chemicals that are not in the tox_chemicals data frame.