Skip to contents

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.

Usage

extr_casrn_from_cid(pubchem_id)

Arguments

pubchem_id

A numeric vector of PubChem CIDs. These are unique identifiers for chemical compounds in the PubChem database.

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.

See also

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
# }