This function retrieves the CASRN for a given set of PubChem Compound Identifiers (CID).
It queries PubChem through the webchem
package and extracts the CASRN from the depositor-supplied synonyms.
Value
A data frame containing the CID, CASRN, and IUPAC name of the compound. The returned data frame includes three columns:
- CID
The PubChem Compound Identifier.
- cas_rn
The corresponding CASRN of the compound.
- IUPACName
The IUPAC name of the compound.
Examples
# \donttest{
# Example with formaldehyde and aflatoxin
cids <- c(712, 14434) # CID for formaldehyde and aflatoxin B1
extr_casrn_from_cid(cids)
#> ℹ Checking Internet Connection...
#> ℹ Internet connection OK...
#> ℹ Querying 712 and 14434.
#> # A tibble: 5 × 3
#> cid cas_rn IUPACName
#> <chr> <chr> <chr>
#> 1 712 50-00-0 Formaldehyde
#> 2 712 30525-89-4 Formaldehyde
#> 3 712 53026-80-5 Formaldehyde
#> 4 712 8013-13-6 Formaldehyde
#> 5 14434 1172-18-5 Flurazepam Hydrochloride
# }