Re: [R] to extract particular date/data

2008-05-02 Thread Richard . Cotton
 If I have this daily rainfall data, how do call a particular day?
 Year,Month,Day,Amount
 1900,12,22,1.3
 1900,12,23,0
 1900,12,24,0
 1900,12,25,0
 1900,12,26,0
 1900,12,27,0
 1900,12,28,0
 1900,12,29,4.8
 1900,12,30,0.3
 1900,12,31,0.5
 1901,1,1,0
 1901,1,2,3
 1901,1,3,0
 1901,1,4,0.5
 1901,1,5,0
 1901,1,6,0
 ...
 I used to use julian.date in S-Plus.

I read your data in as the following data frame:
 rainfall
   Year Month Day Amount
1  190012  221.3
2  190012  230.0
3  190012  240.0
4  190012  250.0
5  190012  260.0
6  190012  270.0
7  190012  280.0
8  190012  294.8
9  190012  300.3
10 190012  310.5
11 1901 1   10.0
12 1901 1   23.0
13 1901 1   30.0
14 1901 1   40.5
15 1901 1   50.0
16 1901 1   60.0

You can access only the days with rainfall$Day, but you might also like to 
convert all the dates to POSIX format.  This code will do the trick:
posixdates - with(rainfall, ISOdate(Year, Month, Day))

posixdates is a vector of class POSIXct, which means it is the number of 
seconds since the start of 1970, with some methods to make it print nicely 
and behave itself in time series plots.

See also ?julian, and the chron package.

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
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.


Re: [R] to extract particular date/data

2008-05-02 Thread Gabor Grothendieck
Have a look at the zoo package which has three vignettes and R News 4/1.

On Fri, May 2, 2008 at 12:27 AM, Roslina Zakaria [EMAIL PROTECTED] wrote:
 Hi R-expert,
 If I have this daily rainfall data, how do call a particular day?
 Year,Month,Day,Amount
 1900,12,22,1.3
 1900,12,23,0
 1900,12,24,0
 1900,12,25,0
 1900,12,26,0
 1900,12,27,0
 1900,12,28,0
 1900,12,29,4.8
 1900,12,30,0.3
 1900,12,31,0.5
 1901,1,1,0
 1901,1,2,3
 1901,1,3,0
 1901,1,4,0.5
 1901,1,5,0
 1901,1,6,0
 ...
 I used to use julian.date in S-Plus.
 Thank you so much for your kind attention and help.


  
 

 [[elided Yahoo spam]]

 __
 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.


[R] to extract particular date/data

2008-05-01 Thread Roslina Zakaria
Hi R-expert,
If I have this daily rainfall data, how do call a particular day?
Year,Month,Day,Amount
1900,12,22,1.3
1900,12,23,0
1900,12,24,0
1900,12,25,0
1900,12,26,0
1900,12,27,0
1900,12,28,0
1900,12,29,4.8
1900,12,30,0.3
1900,12,31,0.5
1901,1,1,0
1901,1,2,3
1901,1,3,0
1901,1,4,0.5
1901,1,5,0
1901,1,6,0
...
I used to use julian.date in S-Plus.
Thank you so much for your kind attention and help.


  


[[elided Yahoo spam]]

__
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.