Learn R Programming

webchem (version 0.0.5.0)

get_csid: Retrieve ChemSpider ID

Description

Return Chemspider ID (CSID) for a search query, see http://www.chemspider.com/.

Usage

get_csid(query, token = NULL, first = FALSE, verbose = TRUE, ...)

Arguments

query
charachter; search term.
token
character; your security token.
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 of class 'csid' with ChemSpider IDs.

See Also

csid_compinfo and csid_extcompinfo to retrieve compound details from csid.

Examples

Run this code
# Fails because no TOKEN is included
token <- '<YOUR-SECURITY-TOKEN>'
get_csid("Triclosan", token = token)
# [1] "5363"
# attr(,"class")
# [1] "csid"
get_csid("3380-34-5", token = token)

###
# multiple inputs
sapply(c('Aspirin', 'Triclosan'), get_csid, token = token)

Run the code above in your browser using DataLab