Wacek Kusnierczyk wrote: > > btw., the error message here is confusing: > > lag = 1:2 > diff(1:10, lag=lag) > # Error in diff.default(1:10, lag = lag) : > # 'lag' and 'differences' must be integers >= 1 > > is.integer(lag) > # TRUE > all(lag >= 1) > # TRUE > > what is meant is that lag and differences must be atomic 1-element > vectors of positive integers. or rather integer-representing numerics: > > lag = 1 > diff(1:5, lag=1) > # fine > is.integer(lag) > # FALSE > >
... and even non-integer-representing non-integers are fine: diff(1:5, lag=pi) # 3 3 vQ ______________________________________________ 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.