post_formula_batch: Post a batch of chemical formulas

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

View source: R/FILTERING-post_formula_batch.R

Description

Functionality to post a batch of up to 100 formulas to obtain a queryId for use in chemspiderapi::get_formula_batch_queryId_status() and chemspiderapi::get_formula_batch_queryId_results().

Usage

1
2
3
4
5
6
7
8
post_formula_batch(
  formulas,
  dataSources = NULL,
  orderBy = "recordId",
  orderDirection = "ascending",
  apikey,
  coerce = FALSE
)

Arguments

formulas

A character vector of up to 100 chemical formulas.

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.

Details

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

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

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

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/batch

Examples

1
2
3
4
5
6
7
## Not run: 
## Post the formulas of caffeine and cocaine to get a query ID
formulas <- c("C9H8O4", "C17H21NO4")
apikey <- "a valid 32-character ChemSpider apikey"
post_formula_batch(formulas = formulas, apikey = apikey)

## End(Not run)

NIVANorge/chemspiderapi documentation built on Jan. 10, 2021, 10:12 a.m.