[R] How to pass parameters to htmlParse Bank of Canada html pages

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Jun 30 22:51:16 CEST 2009


On Tue, Jun 30, 2009 at 9:32 PM, <guox at ucalgary.ca> wrote:
> To get USDCAD rates from Bank of Canada, we first go
>
> url <- "http://banqueducanada.ca/en/rates/exchange-avg.html"
>
> select 12 months for Rates for the past and click "Get Rates" button. Then
> the page moves to
>
> address <- "http://banqueducanada.ca/cgi-bin/famecgi_fdps"
>
> and the rates show in the html page.
>
> htmlParse() can read the html document but
> htmlParse(address) did not work since we need to pass the selected field
> value and clicking Get Rates button event parameters to
> http://banqueducanada.ca/en/rates/exchange-avg.html.
> I was wondering if you know how to load in data from such html pages. Thanks,
>

 I'm not sure what package your htmlParse comes from... Anyway, it
seems you want to be able to send form data via a POST request - use
postForm in the RCurl package. That should set you in the right
direction.

Barry




More information about the R-help mailing list