powered by
Convert collection of html nodes into data frame
html_attrs_dfr( x, attrs = NULL, trim = FALSE, defaults = NA_character_, add_text = TRUE )
data frame with one row per xml node, consisting of an html_text column with text and additional columns with attributes
xml_nodeset object, containing text and attributes of interest
xml_nodeset
character vector of attribute names. If missing, all attributes will be used
if TRUE, will trim leading and trailing spaces
TRUE
character vector of default values to be passed to rvest::html_attr(). Recycled to match length of attrs
rvest::html_attr()
attrs
if TRUE, node content will be added as .text column (using rvest::html_text)
.text
rvest::html_text
# \donttest{ library(polite) library(rvest) bow("https://en.wikipedia.org/wiki/List_of_cognitive_biases") %>% scrape() %>% html_nodes("tr td:nth-child(1) a") %>% html_attrs_dfr() # }
Run the code above in your browser using DataLab