[R] RCurl question

Martin Morgan mtmorgan at fhcrc.org
Sun Jul 4 20:10:12 CEST 2010


On 07/03/2010 10:59 PM, Brad McNeney wrote:
> The following call to curl fetches me the information I want (as html)
> from a webserver:
> 
> curl -F list_file=@snptxt -F html_output=on
> http://integrin.ucd.ie/cgi-bin/rs2cm.cgi
> 
> The file snptxt is a plain-text file in my working directory with the
> following two lines:
> 
> rs6598
> rs123456
> 
> 
> In R I try to replicate this with RCurl as follows:
> 
> require(RCurl)
> postForm(uri="http://integrin.ucd.ie/cgi-bin/rs2cm.cgi",
> "list_file"="@snptxt", "html_output"="on")
> 
> but the table that is supposed to contain my results is empty (table
> caption is Genetic Locations). The cgi script has apparently received
> the html_output=on information though.
> 

Hi Brad

I think the path to the file to be uploaded needs to be wrapped in a
call to fileUpload, along the lines of

  postForm(uri="http://integrin.ucd.ie/cgi-bin/rs2cm.cgi",
      list_file=fileUpload("/tmp/snp.txt"), html_output="on")

Martin

> I get the same results on Linux and Windows -- sessionInfo() for both
> follows.  Any pointers appreciated.
> 
> Thanks,
> 
> Brad
> ---
> Brad McNeney
> Statistics and Actuarial Science
> Simon Fraser University
> 
> Linux:
> 
>> sessionInfo()
> R version 2.11.0 (2010-04-22)
> x86_64-unknown-linux-gnu
> 
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] XML_3.1-0      RCurl_1.4-2    bitops_1.0-4.1
> 
> Windows:
> 
>> sessionInfo()
> R version 2.11.1 (2010-05-31)
> i386-pc-mingw32
> 
> locale:
> [1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252
> [3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C
> [5] LC_TIME=English_Canada.1252
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> other attached packages:
> [1] XML_3.1-0      RCurl_1.4-2    bitops_1.0-4.1
> 
> ______________________________________________
> R-help at 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.


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the R-help mailing list