[R] Ordeing Zoo object

Bogaso bogaso.christofer at gmail.com
Wed Dec 9 07:01:57 CET 2009


Hi all, I would like to ask how to order a Zoo object? Consider following
code

> dat <- zooreg(rnorm(5), as.yearmon(as.Date("2001-01-01")), frequency=12)
> dat
  Jan 2001   Feb 2001   Mar 2001   Apr 2001   May 2001 
-0.8916124 -0.4516505  1.1305884 -1.4881309  0.3703734 

Here I want to order from last to 1st i.e. from May to Jan. So I used
following code :

> dat[5:1]
  Jan 2001   Feb 2001   Mar 2001   Apr 2001   May 2001 
-0.8916124 -0.4516505  1.1305884 -1.4881309  0.3703734 

Therefore I am not getting what I desired. If someone points out the correct
code I would be grateful.

Thanks,
-- 
View this message in context: http://n4.nabble.com/Ordeing-Zoo-object-tp955868p955868.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list