maechler@stat.math.ethz.ch
2000-Aug-21 16:28 UTC
[Rd] diff.default / diff.ts in wrong package bug (PR#640)
{all recent versions of R} Problem / design bug : diff.default() doesn't deal with "ts" objects properly, diff.ts() does, but that is only available from package "ts" where as the constructor function ts() is in base. It's not sufficient to just move diff.ts() to package base, since it relies itself on lag & lag.default which are also only in package ts. ---------------------------------------------------- A simple example :> diff(ts(1:50, start= 1980, frequency = 12))Error in tsp<-(*tmp*, value = c(xtsp[1] + lag * differences * xtsp[3], : invalid time series parameters specified> library(ts)> diff(ts(1:50, start= 1980, frequency = 12))Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1980 1 1 1 1 1 1 1 1 1 1 1 1981 1 1 1 1 1 1 1 1 1 1 1 1 1982 1 1 1 1 1 1 1 1 1 1 1 1 1983 1 1 1 1 1 1 1 1 1 1 1 1 1984 1 1 ------ Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
maechler@stat.math.ethz.ch
2000-Aug-22 16:36 UTC
[Rd] diff.default / diff.ts in wrong package bug (PR#640)
>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:MM> {all recent versions of R} Problem / design bug : MM> diff.default() doesn't deal with "ts" objects properly, diff.ts() MM> does, but that is only available from package "ts" where as the MM> constructor function ts() is in base. MM> It's not sufficient to just move diff.ts() to package base, since MM> it relies itself on lag & lag.default which are also only in MM> package ts. MM> ---------------------------------------------------- MM> A simple example : >> diff(ts(1:50, start= 1980, frequency = 12)) MM> Error in tsp<-(*tmp*, value = c(xtsp[1] + lag * differences * MM> xtsp[3], : invalid time series parameters specified >> library(ts) >> diff(ts(1:50, start= 1980, frequency = 12)) MM> Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1980 1 1 1 1 1 MM> 1 1 1 1 1 1 1981 1 1 1 1 1 1 1 1 1 1 1 1 1982 1 1 1 1 1 1 1 1 1 1 1 MM> 1 1983 1 1 1 1 1 1 1 1 1 1 1 1 1984 1 1 --- answering myself : One easy and "clean" fix is to put the following at the very beginning of diff.default : if(is.ts(x)) { require(ts) UseMethod("diff") } {and then remove the "tsp" stuff at the end of diff.default()}. Now diff(ts(1:20)) gives a one line message ------------------------------------- Loading required package: ts ------------------------------------- but I think this is really okay and desired to some extent. As Prof Ripley pointed out in a private e-mail to me, package ts should really be used for everything "ts"ish, but then we want to have very basic "ts" functionality in package base... The above passes "make check" (and more). Anybody against this? Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
maechler@stat.math.ethz.ch
2000-Sep-15 15:24 UTC
[Rd] diff.default / diff.ts in wrong package bug (PR#640)
>>>>> "PD" == Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:PD> maechler@stat.math.ethz.ch writes: >> One easy and "clean" fix is to put the following at the very >> beginning of diff.default : >> >> if(is.ts(x)) { require(ts) >> UseMethod("diff") } PD> ... >> The above passes "make check" (and more). >> >> Anybody against this? PD> I'm not really pro or con, but what is wrong with autoloading PD> diff.ts?? MM> it does not work, i.e. MM> autload("diff.ts", "ts") diff(ts(1:10)) MM> does not load package ts. It's not so clear if this is a bug in MM> method dispatching ... but assuming ``standard semantic'' (diff.ts MM> is in search() i.e. diff() should dispatch to it), it is one.. MM> Shall I 1) commit my proposed change to "R-release-patches" (since MM> it fixes a bug in R 1.1.1) 2) submit a new bug report about the MM> non-dispatching to "Autoloads" objects ? Just a report to the non-core audience and for the bug-archive: Both of these have been resolved now for "R-devel" [R 1.2 unstable] i. autoload("diff.ts", "ts") now *does* work (thanks to Thomas Lumley) ii. the above autoload is now in the system profile and fixes the diff(.) bug. -- Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Seemingly Similar Threads
- Bug in "[.ts" for multivariate ts {Problem with plot.ts, "["} (PR#216)
- predict.Arima fails when x is not a time-series
- Method dispatch fails for autoloaded methods (PR#642)
- R-alpha: ts problems
- Bug in "[.ts" for multivariate ts {Problem with plot.ts, "[" (PR#217)