post_formula: POST a chemical formula to obtain a query ID

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/FILTERING-post_formula.R

Description

Functionality to POST a formula to obtain a queryId for use in chemspiderapi::get_queryId_status() and chemspiderapi::get_queryId_results().

Usage

1
2
3
4
5
6
7
8
9
post_formula(
  formula,
  dataSources = NULL,
  orderBy = "recordId",
  orderDirection = "ascending",
  apikey,
  coerce = FALSE,
  simplify = FALSE
)

Arguments

formula

A character string of a chemical formula.

dataSources

Optional: Either a single character string or a vector of character string specifying the data sources. A list of possible data sources can be obtained from chemspiderapi::get_datasources().

orderBy

A character string indicating by which parameter the results should be ordered; see Details.

orderDirection

A character string indicating in which direction the results should be ordered; see Details.

apikey

A 32-character string with a valid key for ChemSpider's API services.

coerce

logical: should the list be coerced to a data.frame? Defaults to FALSE.

simplify

logical: should the results be simplified to a vector? Defaults to FALSE.

Details

Possible values for orderBy are: "recordId" (default), "massDefect", "molecularWeight", "referenceCount", "dataSourceCount", "pubmedCount", and "rscCount".

Possible values for orderDirection are: "ascending" (default) and "descending".

Says ChemSpider:

"If dataSources is not specified, all known sources are searched. This will take longer."

If successful, returns the queryId as character string.

Value

Returns the queryId string as (named) character vector.

Author(s)

Raoul Wolf (https://github.com/RaoulWolf/)

See Also

https://developer.rsc.org/compounds-v1/apis/post/filter/formula

Examples

1
2
3
4
5
6
7
## Not run: 
## POST the formula of caffeine to get a query ID
formula <- "C8H10N4O2"
apikey <- "a valid 32-character ChemSpider apikey"
post_formula(formula = formula, apikey = apikey)

## End(Not run)

NIVANorge/chemspideR documentation built on Jan. 8, 2021, 7:48 a.m.