This function queries the **ChemSpider API** to retrieve detailed metabolite information for a given ChemSpider ID, including molecular formula, mass, InChI, InChIKey, and other properties.

request_chemspider_metabolite(chemspider_id, chemspider_apikey = "")

Arguments

chemspider_id

Numeric or character. The ChemSpider compound ID(s) to query.

chemspider_apikey

Character. The API key required to access the ChemSpider database. **How to Obtain a ChemSpider API Key:** 1. Visit the **Royal Society of Chemistry (RSC) Developer Portal**: [https://developer.rsc.org/](https://developer.rsc.org/) 2. Sign in or create an account. 3. Navigate to **My Account** > **API Keys**. 4. Apply for access to the **ChemSpider API**. 5. Once approved, generate your API key and copy it for use. 6. Use this key as the `chemspider_apikey` argument in this function.

Value

A data frame containing metabolite properties retrieved from ChemSpider. If the request fails, the function returns `NA`.

The returned data frame includes the following columns: - **id**: ChemSpider compound ID. - **SMILES**: Simplified molecular-input line-entry system (SMILES) notation. - **Formula**: Molecular formula. - **InChI**: IUPAC International Chemical Identifier. - **InChIKey**: Standard InChIKey. - **StdInChI**: Standardized InChI identifier. - **StdInChIKey**: Standardized InChIKey. - **AverageMass**: Average molecular mass. - **MolecularWeight**: Exact molecular weight. - **MonoisotopicMass**: Monoisotopic mass. - **NominalMass**: Nominal mass. - **CommonName**: Commonly used name. - **ReferenceCount**: Number of references in ChemSpider. - **DataSourceCount**: Number of linked data sources. - **PubMedCount**: Number of associated PubMed articles. - **RSCCount**: Number of references in the Royal Society of Chemistry database.

Examples

# Retrieve metabolite information for a specific ChemSpider ID
request_chemspider_metabolite(chemspider_id = 12345, chemspider_apikey = "your_key")
#> [1] NA

# Retrieve information for multiple IDs
request_chemspider_metabolite(chemspider_id = c(12345, 67890), chemspider_apikey = "your_key")
#> [1] NA