[R] Lags and Differences of zoo Objects
pdb
philb at philbrierley.com
Sat Jul 31 06:07:09 CEST 2010
Hi,
I'm struggling to understand the documentation.
?lag.zoo
x - a "zoo" object.
k, lag - the number of lags (in units of observations). Note the sign of k
behaves as in lag.
differences - an integer indicating the order of the difference.
What does the above line actually mean? I've tried a few settings on sample
data but can't figure out what it is doing.
x <- iris
x$Species = NULL
x$Petal.Width = NULL
x$Sepal.Width = NULL
x$Sepal.Length = NULL
x <- zoo(x)
x <-
merge(orig = x
,lag1diff2 = diff(x, lag = 1, differences = 2, arithmetic = TRUE, na.pad =
TRUE)
,lag2diff1 = diff(x, lag = 2, differences = 1, arithmetic = TRUE, na.pad =
TRUE)
,lag2diff2 = diff(x, lag = 2, differences = 2, arithmetic = TRUE, na.pad =
TRUE)
)
head(x)
--
View this message in context: http://r.789695.n4.nabble.com/Lags-and-Differences-of-zoo-Objects-tp2308666p2308666.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list