Re: [R] convert S-Plus function to R function

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue, 06 May 2008 23:05:32 -0400

R News 4/1 has an article on this dates and the last page contains a table with many date idioms.

On Tue, May 6, 2008 at 10:00 PM, Roslina Zakaria <zroslina_at_yahoo.com> wrote:
> Hi R-expert,
> If I have this daily rainfall data, how do call a particular set of data?
>
> Year,Month,Day,Amount
> 1981,1,1,0
> 1981,1,2,0
> 1981,1,3,78
> 1981,1,4,22
> 1981,1,5,2
> 1981,1,6,0
> 1981,1,7,0
> 1981,1,8,0
> 1981,1,9,0
> 1981,1,10,10
> 1981,1,11,0
> 1981,1,12,108
> 1981,1,13,328
> 1981,1,14,10
> 1981,1,15,0
> 1981,1,16,6
> 1981,1,17,0
> 1981,1,18,28
> 1981,1,19,0
> 1981,1,20,0
> 1981,1,21,0
> 1981,1,22,0
> 1981,1,23,0
> 1981,1,24,0
> 1981,1,25,32
> 1981,1,26,0
> 1981,1,27,2
> 1981,1,28,0
> 1981,1,29,2
> 1981,1,30,0
> 1981,1,31,0
> 1981,2,1,0
> 1981,2,2,118
> 1981,2,3,0
> 1981,2,4,0
> 1981,2,5,0
> 1981,2,6,12
> 1981,2,7,0
> 1981,2,8,0
> 1981,2,9,46
> 1981,2,10,4
> 1981,2,11,0
> 1981,2,12,0
> 1981,2,13,0
> 1981,2,14,0
> 1981,2,15,0
> 1981,2,16,0
> 1981,2,17,0
> 1981,2,18,0
> 1981,2,19,0
> 1981,2,20,0
> 1981,2,21,4
> 1981,2,22,16
> 1981,2,23,0
> 1981,2,24,0
> 1981,2,25,2
> 1981,2,26,0
> 1981,2,27,0
> 1981,2,28,0
> 1981,3,1,0
> 1981,3,2,0
> 1981,3,3,0
> 1981,3,4,0
> 1981,3,5,0
> 1981,3,6,0
> 1981,3,7,0
> 1981,3,8,0
> 1981,3,9,106
> 1981,3,10,10
> 1981,3,11,0
> 1981,3,12,0
> 1981,3,13,0
> 1981,3,14,0
> 1981,3,15,32
> ...
> For example, if I would like to extract january and february data, and use 1/1/1901 as the origin. How do I use the dates function in R ? I did try to lookup in the manual, but not sure how to apply it?
> This is my code in S-plus.
> define.date1<-function(dt1,mt1,mt2,nn,da)
> { mt2<-mt2+1
> start<-julian(mt1, 1, nn, origin=c(month=1, day=1, year=1971))+1
> end<-julian(mt2, 1, nn, origin=c(month=1, day=1, year=1971))+da
> a<-dt1[start:end,]
> am<-as.matrix(a[,5])
> }
> Thank you so much for your kind attention and help.
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> ______________________________________________
> 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.
>



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. Received on Wed 07 May 2008 - 03:12:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 07 May 2008 - 04:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive