Learn R Programming

PubChemR (version 2.1.4)

sectionList: List Available Section/Subsections

Description

This function may be used to list available sections (or subsections) of a PubChem request returned from get_pug_view. It is useful when one wants to extract a specific section (or subsection) from PubChem request. It supports patteern-specific searches within sections. See Detail/Note below for more information.

Usage

sectionList(object, ...)

# S3 method for PugViewInstance sectionList(object, ...)

# S3 method for PugViewSectionList sectionList( object, .pattern = NULL, .match_type = c("contain", "match", "start", "end"), ... )

# S3 method for PugViewSection sectionList( object, .pattern = NULL, .match_type = c("contain", "match", "start", "end"), ... )

Arguments

object

an object of PubChem request, generally returned from get_pug_view.

...

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

.pattern

a character vector. Each text pattern given here will be searched within Pug View sections by using the pattern matching strategy defined with .match_type. If not specified or NULL, all available sections will be returned.

.match_type

a string. How should search patterns (i.e., .pattern) matched with section names? Available options are "contain", "match", "start", and "end" which can be used for partial and/or exact pattern matching. Default is "contain". See Details below for more information.

Details

Pattern matching is used to filter sections that match user-defined patterns. It is useful when there are more sections than allowed to print R console. In such situations, it may be reasonable to print a subset of all section list to R console that meets search criteria. There are several pattern matching methods as described below

  • Partial Matching ("contain", "start", "end"): Returns the section names that contains or starts/ends by given text patterns.

  • Exact Matching ("match"): Returns the section names that exactly matches given text patterns.

See Also

section

Examples

Run this code
pview <- get_pug_view(identifier = "2244", annotation = "data", domain = "compound")

# List all section names
sectionList(pview)

# Pattern-matched section names
sectionList(pview, .pattern = c("safety", "chemical"), .match_type = "contain")
sectionList(pview, .pattern = "safety", .match_type = "match")
sectionList(pview, .pattern = "properties", .match_type = "end")

# Use section IDs to extract section data from Pug View request
section(pview, "S12") # Safety and Hazards

Run the code above in your browser using DataLab