section {PubChemR}R Documentation

Extract Sections from Pug View Request

Description

section returns section details from a Pug View request.

Usage

section(object, ...)

## S3 method for class 'PugViewInstance'
section(object, .id = "S1", .verbose = FALSE, ...)

## S3 method for class 'PugViewSectionList'
section(object, .id = "S1", .verbose = FALSE, ...)

## S3 method for class 'PugViewSection'
section(object, .id = "S1", .verbose = FALSE, ...)

Arguments

object

an object returned from get_pug_view.

...

other arguments. Currently has no effect on the outputs. Can be ignored.

.id

A character value that corresponds to the ID of a specific section. Detailed information about the section with the given section ID will be returned. If NULL, the first section (i.e., "S1") is returned. If there is no section under object, it returns NULL with a warning. See Note/Details for more information.

.verbose

A logical value. Should the resulting object be printed to the R console? If TRUE, the object is returned invisibly and the output is printed nicely to the R console. This option may not be available for some slots (or classes). See Notes/Details.

Note

Sections in a Pug View Request

A Pug View Request returns a detailed list from the PubChem database. This list may include data under many nested sections, each corresponding to a different property structured within further nested sections. The complicated structure of the returned object makes it impossible to print all information to the R console at once. Therefore, it is recommended to print sections selectively. Furthermore, one may navigate through the nested sections using the section function. See Examples.

Use the sectionList function to list available sections (or subsections of a section) of a Pug View request and related section IDs.

Use of '.verbose' to Print Section Details

It is possible to print section details to the R console. If .verbose = TRUE, the resulting object is returned invisibly and a summary of section details is printed to the R console. This might be useful to navigate through nested sections and sequentially print multiple sections to the R console. For example, consider following command:

> section(section(request, "S1", .verbose = TRUE), "S3", .verbose = TRUE)

This command will print section "S1" and the subsection "S3" located under "S1" to the R console. One may navigate through sections under other sections, similar to exploring dreams within dreams as depicted in the exceptional movie Inception. (SPOILER WARNING!!) However, be careful not to get lost or stuck in the dreams!! Also, note that this strategy works only if .verbose = TRUE for all sections and/or subsections.

See Also

sectionList

Examples

# Pug View request for the compound "aspirin (CID = 2244)".
pview <- get_pug_view(identifier = "2244", annotation = "data", domain = "compound")

section(pview, "S1")
section(pview, "S1", .verbose = TRUE)

# List all available sections
sectionList(pview)

# Subsections under the section "S1"
sectionList(section(pview, "S1"))

# Print multiple sections
# section(section(pview, "S1", .verbose = TRUE), "S3", .verbose = TRUE)


[Package PubChemR version 2.0 Index]