Skip to content

Commit 02c6045

Browse files
author
maechler
committed
FIXME done in diff.ts
git-svn-id: https://svn.r-project.org/R/trunk@89092 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent eed5c29 commit 02c6045

File tree

1 file changed

+1
-9
lines changed
  • src/library/stats/R

1 file changed

+1
-9
lines changed

src/library/stats/R/ts.R

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,9 @@ diff.ts <- function (x, lag = 1, differences = 1, ...)
266266
stop("bad value for 'lag' or 'differences'")
267267
if (lag * differences >= NROW(x))
268268
return(if(is.matrix(x)) x[0L, , drop = FALSE] else x[0L])
269-
## <FIXME>
270-
## lag() and its default method are defined in package ts, so we
271-
## need to provide our own implementation.
272-
tsLag <- function(x, k = 1) {
273-
p <- tsp(x)
274-
tsp(x) <- p - (k/p[3L]) * c(1, 1, 0)
275-
x
276-
}
277269
r <- x
278270
for (i in 1L:differences) {
279-
r <- r - tsLag(r, -lag)
271+
r <- r - lag(r, -lag)
280272
}
281273
xtsp <- attr(x, "tsp")
282274
if(is.matrix(x)) colnames(r) <- colnames(x)

0 commit comments

Comments
 (0)