Learn R Programming

PubChemR (version 3.0.0)

pc_collect: Collect Results From an Async PubChem Query

Description

Resolves a `PubChemAsyncQuery` object to a final `PubChemResult` by polling when a listkey is present, or returning the initial response otherwise.

Usage

pc_collect(x, ...)

Value

A `PubChemResult` object.

Arguments

x

A `PubChemAsyncQuery` object.

...

Additional arguments passed to `pc_poll`.

Details

This helper simplifies asynchronous flow control by encapsulating the listkey/no-listkey branching logic in one call.

Examples

Run this code
q <- structure(
  list(
    initial = pc_request(identifier = 2244, offline = TRUE),
    listkey = NULL,
    domain = "compound",
    operation = NULL,
    output = "JSON",
    options = NULL
  ),
  class = "PubChemAsyncQuery"
)
out <- pc_collect(q)
inherits(out, "PubChemResult")

Run the code above in your browser using DataLab