At first pass it would seem that 'integer' would make a perfectly fine year class. But for some reason it's disallowed:
> xts(rnorm(8), 2000L:2007) Error in xts(rnorm(8), 2000L:2007) : order.by requires an appropriate time-based object Which is a bit unexpected, since xts descends from zoo and this works fine: > zoo(rnorm(8), 2000L:2007) 2000 2001 2002 2003 2004 2005 2006 2007 0.2963980 -1.7928750 1.9253476 -0.6851739 0.3223047 0.7776734 -0.3255266 -1.0980489 That doesn't feel very eXtensible to me. -John On Tue, Apr 8, 2014 at 4:27 PM, Michael Weylandt <michael.weyla...@gmail.com > wrote: > > > On Apr 8, 2014, at 15:15, Erin Hodgess <erinm.hodg...@gmail.com> wrote: > > > Hello! > > > > If I have the following: > > > > x <- as.yearqtr(2000 + seq(0,7)/4) > > x > > [1] "2000 Q1" "2000 Q2" ... > > > > which is as it should be. > > Then if I set up time as > > time <- xts(1:8,x) > > time > > 2000 Q1 1 > > 2000 Q2 2 > > 2000 Q3 3 > > . > > . > > > > Also fine > > Now suppose I want to have an annual xts object. How do I go about > setting > > that up, please? > > Not quite as transparently. R does not (to my knowledge) have a commonly > used 'year' class. > > You can of course use yearqtr objects and skip 3/4 per year. > > > > > Thanks, > > Erin > > > > > > -- > > Erin Hodgess > > Associate Professor > > Department of Computer and Mathematical Sciences > > University of Houston - Downtown > > mailto: erinm.hodg...@gmail.com > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.