If you simply want successive differences use diff: x <- seq(4)^2 diff(x)
tx <- ts(x) diff(tx) On Sun, Oct 12, 2008 at 9:19 AM, Oliver Bandel <[EMAIL PROTECTED]> wrote: > Zitat von Gabor Grothendieck <[EMAIL PROTECTED]>: > >> On Sun, Oct 12, 2008 at 7:24 AM, Oliver Bandel >> <[EMAIL PROTECTED]> wrote: > [...] >> >> The input to numericDeriv is not values but an expression. >> See the Examples section at the end of ?numericDeriv >> The expression given as the first arg >> ultimately needs to be evaluated at a value so it needs to >> know where to find that value. Note that it defaults >> to the caller's environment so we can leave that argument >> out if the variable is known to be there: >> >> X <- 3 >> numericDeriv(quote(X^2), "X") > [...] > > Well, that's quite close to symbolic derivation. > > I have a dataset, that I want to derive numerically > "quote(X^2)" is providing a function. I have a dataset. > > So I may write my own derivative function? > Or is there something as part of the ts-class available? > > Ciao, > Oliver > ______________________________________________ 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.