Learn R Programming

webchem (version 0.0.5.0)

cs_extcompinfo: Get extended record details by ChemSpider ID

Description

Get extended info from Chemspider, see http://www.chemspider.com/

Usage

cs_extcompinfo(csid, token, verbose = TRUE, ...)

Arguments

csid
character, ChemSpider ID.
token
character; security token.
verbose
logical; should a verbose output be printed on the console?
...
currently not used.

Value

  • a list with entries: 'csid', 'mf' (molecular formula), 'smiles', 'inchi', 'inchikey', 'average_mass', 'mw' (Molecular weight), 'monoiso_mass' (MonoisotopicMass), 'nominal_mass', 'alogp', 'xlogp', 'common_name' and 'source_url'

See Also

get_csid to retrieve ChemSpider IDs, csid_compinfo for extended compound information.

Examples

Run this code
# Fails because no TOKEN is included
token <- '<YOUR-SECURITY-TOKEN>'
# convert CAS to CSID
csid <- get_csid("Triclosan", token = token)
# get SMILES from CSID
cs_extcompinfo(csid, token)

###
# multiple inpits
csids <- sapply(c('Aspirin', 'Triclosan'), get_csid, token = token)
# fails:
# cs_extcompinfo(csids, token = token)
(ll <- lapply(csids, cs_extcompinfo, token = token))
# to matrix
do.call(rbind, ll)

Run the code above in your browser using DataLab