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.

______________________________________________
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.

Reply via email to