Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readHTMLList

Read data in an HTML list or all lists in a document


Description

This function and its methods are somewhat similar to readHTMLTable but read the contents of lists in an HTML document. We can specify the URL of the document or an already parsed document or an individual node within the document.

Usage

readHTMLList(doc, trim = TRUE, elFun = xmlValue, which = integer(), ...)

Arguments

doc

the URL of the document or the parsed HTML document or an individual node.

trim

a logical value indicating whether we should remove leading and trailing white space in each list item when returning it

elFun

a function that is used to process each list item node (li). This provides an opportunity to customize how each node is processed, for example accessing attributes on the list item or on its contents such as links in the items.

which

an index or name which or vector of same which identifies which list nodes to process in the overall document. This is for subsetting particular lists rather than processing them all.

...

additional arguments passed to htmlParse and for the specific methods.

Value

A list of character vectors or lists, with one element for each list in the document. If only one list is being read (by specifying which as a single identifier), that is returned as is.

Author(s)

Duncan Temple Lang

See Also

Examples

try(readHTMLList("http://www.omegahat.net"))

XML

Tools for Parsing and Generating XML Within R and S-Plus

v3.99-0.10
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>), Tomas Kalibera [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.