instance: Retrieve Information for Requested Instances

View source: R/getter_functions.R

instanceR Documentation

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 class '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

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

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


PubChemR documentation built on April 4, 2025, 2:18 a.m.