View source: R/download_table.R
download_table | R Documentation |
Download a online table
download_table(url, xpath, save_as)
url |
url of the webpage containing the table |
xpath |
xpath of the table |
save_as |
save table as "save_as.csv" file |
Inspect the webpage, highlight css code for table, right click then copy –> copy XPath, and paste inside SINGLE quote ' ' as xpath contains double quotes.
Package xml2 is required for rvest. Need to import it explicitly in the package.
a data frame or a saved csv file
## Not run:
table_df <- download_table(
'https://en.wikipedia.org/wiki/Judgment_of_Paris_(wine)',
'//*[@id="mw-content-text"]/div/table[5]',
"wine.csv"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.