Learn R Programming

PubChemR (version 2.1.4)

instance: Retrieve Information for Requested Instances

Description

This function extracts the results of a PubChem instance from an object. It is designed to retrieve information about a compound from a comprehensive list where multiple elements (such as assay, compound, etc.) are requested.

Usage

instance(object, ...)

# S3 method for PubChemInstanceList instance(object, .which = NULL, ...)

Arguments

object

An object of class 'PubChemInstanceList' returned from a PubChem request.

...

Additional arguments passed to other methods. Currently, these have no effect.

.which

A string specifying which instance's results to return. If NULL, the results of the first instance in the object are returned. The default value is NULL.

Examples

Run this code
compounds <- get_compounds(
  identifier = c("aspirin", "ibuprofen"),
  namespace = "name"
)

instance(compounds)  # Returns the results for "aspirin"
instance(compounds, "ibuprofen")

Run the code above in your browser using DataLab