R reading html table from a web page

library(XML)
theurl <- "http://finance.yahoo.com" tables <- readHTMLTable(theurl) n.rows <- unlist(lapply(tables, function(t) dim(t)[1])) the picked table is the longest one on the page lstRes <- tables[[which.max(n.rows)]] as.data.frame(lstRes)

Leave a Reply

Your email address will not be published. Required fields are marked *