[R] beginner data.frame question

Oliver Bandel oliver at first.in-berlin.de
Thu Dec 25 20:49:58 CET 2008


John Fox <jfox <at> mcmaster.ca> writes:

> 
> Dear Kirk,
> 
> Actually, co2 isn't a data frame but rather a "ts" (timeseries) object. A
> nice thing about R is that you can query and examine objects:
> 
> > class(co2)
> [1] "ts"
[...]

Yes.

And with 


> frequency(co2)
[1] 12

One gets "the number of observations per unit of time".

When one sets the parameter "start" and "frequency" or "start" and "deltat" or
"start" and "end" of a time-series, one can set the used values and that means
that functions that use those values, also will be controlled by this.

> start(co2)
[1] 1959    1
> end(co2)
[1] 1997   12


Rearranging by creaating a new ts-object with different
timely parameters:

> new_co2 <- ( ts( co2,frequency=1, start=1959) )
> start(new_co2)
[1] 1959    1
> end(new_co2)
[1] 2426    1


... and the way back:

> old_co2 <- ( ts( new_co2, frequency=12, start=1959) )
> start(old_co2)
[1] 1959    1
> end(old_co2)
[1] 1997   12
> 


using plot on those values will result in different plots.


Why the mentioned test data is showed different wih summary,
I don't see now, but I think the reason can also be found here!


To have the test-data (or the way how it was constructed)
could help in helping.

Ciao,
   Oliver



More information about the R-help mailing list