Re: [R] Ordering zoo-object by its index
Hi, Gabor Yes, I am familiar with tail() function. I use it extensively on a day to day basis. In this particular case I needed to order a zoo object by date, after I have created it with RBloomberg. Thank you for your time! Regards, Sergey On Thu, Jul 9, 2009 at 14:36, Gabor Grothendieck wrote: > One additional thought. If the reason you want to do that is > just so that you can see the last few rows more easily then > > tail(Data) > > will display the last few rows or tail(Data, 10) will display > the last 10 rows. > > On Thu, Jul 9, 2009 at 7:36 AM, Sergey Goriatchev wrote: >> Hi, Gabor >> >> Thank you! >> That is exactly what I did, even before your email. :-) >> >> Regards, >> Sergey >> >> On Thu, Jul 9, 2009 at 12:52, Gabor Grothendieck >> wrote: >>> To display that object in reverse time order try this: >>> >>> as.data.frame(Data)[nrow(Data):1, ] >>> >>> >>> On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goriatchev wrote: Hello everyone, Say I have zoo object x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 x <- zoo(rnorm(5), x.Date) y <- zoo(rt(5, df=2), x.Date) z <- zoo(rt(5, df=5), x.Date) Data <- merge(x,y,z) What should I do to make the latest values appear at the top? Thank you for your help! Regards, Sergey __ 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. >>> >> >> >> >> -- >> I'm not young enough to know everything. /Oscar Wilde >> Experience is one thing you can't get for nothing. /Oscar Wilde >> When you are finished changing, you're finished. /Benjamin Franklin >> Tell me and I forget, teach me and I remember, involve me and I learn. >> /Benjamin Franklin >> Luck is where preparation meets opportunity. /George Patten >> > -- I'm not young enough to know everything. /Oscar Wilde Experience is one thing you can't get for nothing. /Oscar Wilde When you are finished changing, you're finished. /Benjamin Franklin Tell me and I forget, teach me and I remember, involve me and I learn. /Benjamin Franklin Luck is where preparation meets opportunity. /George Patten __ 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] Ordering zoo-object by its index
One additional thought. If the reason you want to do that is just so that you can see the last few rows more easily then tail(Data) will display the last few rows or tail(Data, 10) will display the last 10 rows. On Thu, Jul 9, 2009 at 7:36 AM, Sergey Goriatchev wrote: > Hi, Gabor > > Thank you! > That is exactly what I did, even before your email. :-) > > Regards, > Sergey > > On Thu, Jul 9, 2009 at 12:52, Gabor Grothendieck > wrote: >> To display that object in reverse time order try this: >> >> as.data.frame(Data)[nrow(Data):1, ] >> >> >> On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goriatchev wrote: >>> Hello everyone, >>> >>> Say I have zoo object >>> >>> x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 >>> x <- zoo(rnorm(5), x.Date) >>> y <- zoo(rt(5, df=2), x.Date) >>> z <- zoo(rt(5, df=5), x.Date) >>> >>> Data <- merge(x,y,z) >>> >>> What should I do to make the latest values appear at the top? >>> >>> Thank you for your help! >>> >>> Regards, >>> Sergey >>> >>> __ >>> 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. >>> >> > > > > -- > I'm not young enough to know everything. /Oscar Wilde > Experience is one thing you can't get for nothing. /Oscar Wilde > When you are finished changing, you're finished. /Benjamin Franklin > Tell me and I forget, teach me and I remember, involve me and I learn. > /Benjamin Franklin > Luck is where preparation meets opportunity. /George Patten > __ 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] Ordering zoo-object by its index
Hi, Gabor Thank you! That is exactly what I did, even before your email. :-) Regards, Sergey On Thu, Jul 9, 2009 at 12:52, Gabor Grothendieck wrote: > To display that object in reverse time order try this: > > as.data.frame(Data)[nrow(Data):1, ] > > > On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goriatchev wrote: >> Hello everyone, >> >> Say I have zoo object >> >> x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 >> x <- zoo(rnorm(5), x.Date) >> y <- zoo(rt(5, df=2), x.Date) >> z <- zoo(rt(5, df=5), x.Date) >> >> Data <- merge(x,y,z) >> >> What should I do to make the latest values appear at the top? >> >> Thank you for your help! >> >> Regards, >> Sergey >> >> __ >> 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. >> > -- I'm not young enough to know everything. /Oscar Wilde Experience is one thing you can't get for nothing. /Oscar Wilde When you are finished changing, you're finished. /Benjamin Franklin Tell me and I forget, teach me and I remember, involve me and I learn. /Benjamin Franklin Luck is where preparation meets opportunity. /George Patten __ 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] Ordering zoo-object by its index
To display that object in reverse time order try this: as.data.frame(Data)[nrow(Data):1, ] On Thu, Jul 9, 2009 at 5:21 AM, Sergey Goriatchev wrote: > Hello everyone, > > Say I have zoo object > > x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 > x <- zoo(rnorm(5), x.Date) > y <- zoo(rt(5, df=2), x.Date) > z <- zoo(rt(5, df=5), x.Date) > > Data <- merge(x,y,z) > > What should I do to make the latest values appear at the top? > > Thank you for your help! > > Regards, > Sergey > > __ > 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] Ordering zoo-object by its index
Hello everyone, Say I have zoo object x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 x <- zoo(rnorm(5), x.Date) y <- zoo(rt(5, df=2), x.Date) z <- zoo(rt(5, df=5), x.Date) Data <- merge(x,y,z) What should I do to make the latest values appear at the top? Thank you for your help! Regards, Sergey __ 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.