Learn R Programming

webchem (version 0.0.4.0)

get_cid: Retrieve Pubchem Id (CID)

Description

Return CompoundID (CID) for a search query, see https://pubchem.ncbi.nlm.nih.gov/.

Usage

get_cid(query, first = FALSE, verbose = TRUE, ...)

Arguments

query
charachter; search term.
first
logical; If TRUE return only first result.
verbose
logical; should a verbose output be printed on the console?
...
currently not used.

Value

  • a character vector.

Examples

Run this code
# might fail if API is not available
get_cid('Triclosan')

# multiple inputs
comp <- c('Triclosan', 'Aspirin')
sapply(comp, function(x) get_cid(x))
sapply(comp, function(x) get_cid(x, first = TRUE))

Run the code above in your browser using DataLab