library(rvest)
# Get the data file and unzip it if not already present
if (!file.exists("data-raw/nyse_o")) {
tmp <- tempfile(fileext = ".zip")
download.file("http://www.cs.technion.ac.il/~rani/portfolios/NYSE.zip", tmp)
unzip(tmp, exdir = "data-raw/nyse_o")
# Get the metadata
download.file("http://www.cs.technion.ac.il/~rani/portfolios/NYSE_Dataset.htm",
"data-raw/nyse_o/NYSE_dataset.htm")
}
html <- read_html("data-raw/nyse_o/NYSE_dataset.htm")
stock_names <- html %>%
html_nodes("li") %>%
html_text()
nyse_o <- "data-raw/nyse_o/NYSE.txt" %>%
read.csv(header = FALSE, sep = "") %>%
as.tbl
colnames(nyse_o) <- stock_names
save(nyse_o, file="data/nyse_o.RData")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.