简体   繁体   中英

readHTMLTable using readHTMLTable

I'm trying to read in a table into R for this link: http://www.insidestocks.com/optqte.asp?sym=ESU4&view=add&mode=d

My R code is below. For some reason it is not recognizing the table. Perhaps there is a better package for me to use to do this? Any help would be appreciated!

library(XML)
theurl <- "http://www.insidestocks.com/optqte.asp?sym=ESU4&view=add&mode=d"
tables <- readHTMLTable(theurl)
n.rows <- unlist(lapply(tables, function(t) dim(t)[1]))
tables[[whictablesh.max(n.rows)]]

The relevant one is the seventh table.

tables[[7]]

And we get

Strike Open    High     Low    Close Change Volume Open Int Prem ($)
1 600.00C      1247.75 1243.20 1243.25s  +9.75      0      202 62162.50
2 600.00P         0.05    0.01    0.01s   unch      0        0     0.50
3 625.00C      1222.75 1218.20 1218.25s  +9.75      0      202 60912.50
4 625.00P         0.05    0.01    0.01s   unch      0        0     0.50
5 650.00C      1197.75 1193.20 1193.25s  +9.75      0        0 59662.50

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM