Hello,

I've just noticed that na.strings is not needed and will not be used by readHTMLTable. I was with the false impression that the dots argument was to pass other arguments to read.table, but it's not, they're passed to as.data.frame, that doesn't use na.strings.

Rui Barradas

Em 22-04-2014 17:38, Rui Barradas escreveu:
Hello,

Have you tried which=2?

dat <- readHTMLTable(readLines(Link), which = 2, header = TRUE,
na.strings = "-")

dat[, 3:15] <- lapply(dat[, 3:15], function(x) sub("([[:digit:]]) [ab]",
"\\1", x))
dat[, 3:15] <- lapply(dat[, 3:15], function(x)as.numeric(as.character(x)))

str(dat)


Hope this helps,

Rui Barradas

Em 22-04-2014 16:30, Christofer Bogaso escreveu:
Hi Rui,

Sorry to late reply. Thanks for your pointer.

However using this method, I am having difficulty to download related
data from same site.

I need to download data from:


'http://www.cmegroup.com/trading/energy/natural-gas/natural-gas_quotes_globex_options.html?optionExpiration=K4#optionProductId=1352'


So I tried following:

library(XML)
Link <-
'http://www.cmegroup.com/trading/energy/natural-gas/natural-gas_quotes_globex_options.html?optionExpiration=K4#optionProductId=1352'

readHTMLTable(readLines(Link), which = 1, header = TRUE, na.strings =
"-")

Unfortunately I didnot get what I wanted.

Can you (or someone) please help me on this?

Thanks for your time.


On Wed, Apr 9, 2014 at 1:34 AM, Rui Barradas <ruipbarra...@sapo.pt
<mailto:ruipbarra...@sapo.pt>> wrote:

    Hello,

    Try the following.

    library(XML)
    URL <-

"http://www.cmegroup.com/__trading/interest-rates/stir/__eurodollar_quotes_openOutcry.__html


<http://www.cmegroup.com/trading/interest-rates/stir/eurodollar_quotes_openOutcry.html>"


    dat <- readHTMLTable(readLines(URL), which=1, header=TRUE,
    na.strings = "-")

    str(dat)
    dat[4:10] <- lapply(dat[4:10], function(x)
as.numeric(as.character(x)))
    head(dat)


    Hope this helps,

    Rui Barradas

    Em 08-04-2014 20:40, Christofer Bogaso escreveu:

        Hi again,

        I am looking some way to download this data:


http://www.cmegroup.com/__trading/interest-rates/stir/__eurodollar_quotes_openOutcry.__html


<http://www.cmegroup.com/trading/interest-rates/stir/eurodollar_quotes_openOutcry.html>


        So far I have tried following code:

        library(XML)
        data <- xmlParse("

http://www.cmegroup.com/__trading/interest-rates/stir/__eurodollar_quotes_openOutcry.__html


<http://www.cmegroup.com/trading/interest-rates/stir/eurodollar_quotes_openOutcry.html>

        ")

        However not be able to get in right way.

        Really appreciate if someone point me on right approach.

        Thanks for your time.

                 [[alternative HTML version deleted]]

        ________________________________________________
        R-help@r-project.org <mailto:R-help@r-project.org> mailing list
        https://stat.ethz.ch/mailman/__listinfo/r-help
        <https://stat.ethz.ch/mailman/listinfo/r-help>
        PLEASE do read the posting guide
        http://www.R-project.org/__posting-guide.html
        <http://www.R-project.org/posting-guide.html>
        and provide commented, minimal, self-contained, reproducible
code.



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to