[R] operating website through R
Suzen, Mehmet
msuzen at gmail.com
Sat Apr 12 12:01:44 CEST 2014
This looks not so elegant, while normally data provider must have a
nice accessing API, anyway, for example you can do this:
> myAdd <- 'http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/Giovanni_cgi.pl?west=60&north=50&east=70&south=-50¶ms=0|3B42_V7&plot_type=Area+Plot&byr=2014&bmo=01&bdy=31&eyr=2014&emo=01&edy=31&begin_date=1998%2F01%2F01&end_date=2014%2F01%2F31&cbar=cdyn&cmin=&cmax=&yaxis=ydyn&ymin=&ymax=&yint=&ascres=0.25x0.25&global_cfg=tovas.global.cfg.pl&instance_id=TRMM_V7&prod_id=3B42_daily&action=ASCII+Output'
> myData <- read.table(myAdd, skip=5, header=T)
Will give you this:
> str(myData)
'data.frame': 16441 obs. of 3 variables:
$ Latitude : num -50 -50 -50 -50 -50 -50 -50 -50 -50 -50 ...
$ Longitude: num 60 60.2 60.5 60.8 61 ...
$ AccRain : num 0 0.42 0.39 0.42 0.66 1.23 2.31 2.37 3.72 3.63 ...
For choosing different parameters, for example in case of coordinates,
you just need to change the values in 'myAdd' parameters after
Giovanni_cgi.pl?, west, north, east, south. But you must be sure that
there is a data available with those parameters, no magical error
control here.
On 11 April 2014 17:45, eliza botto <eliza_botto at hotmail.com> wrote:
> Dear Suzen,
>
> I couldn't understand. Could you please elaborate it with a small example?
>
> :(
>
> Thanks in advance.
>
> Eliza
>
>> Date: Fri, 11 Apr 2014 17:31:18 +0200
>> Subject: Re: [R] operating website through R
>> From: msuzen at gmail.com
>> To: eliza_botto at hotmail.com
>> CC: r-help at r-project.org
>
>>
>> You just need to pass the parameters on Giovanni_cgi.pl with
>> action=ASCII+Output
>>
>> On 11 April 2014 17:19, eliza botto <eliza_botto at hotmail.com> wrote:
>> > Dear Users of R,
>> > I wanted to operate certain slots of this website
>> > (http://disc2.nascom.nasa.gov/Giovanni/tovas/TRMM_V7.3B42_daily.2.shtml)
>> > through R. I wanted to operate Latitude, longitude section, plot type, begin
>> > and end year and ASCII Output Resolution. The filling of these slot will
>> > produce and output file with I want to D/L at a certain location in my PC.
>> > I have a matrix of 2 columns and 3000 rows which contain Latitude and
>> > Longitude information which i want to upload automatically in the slots of
>> > website. I tried to use certain web scarping techniques in R but to no use.
>> > Is there a way of doing it in R.
>> > thank you very much in advance,
>> > Eliza
>> >
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > 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.
More information about the R-help
mailing list