prechelt@ira.uka.de
1999-Aug-23 18:27 UTC
Strange 'Unimplemented feature in rep' error (PR#254)
I have a large computation that performs various bootstrap resampling loops over pairs of samples using lapply(). After a few seconds it stops like this> do.summarize.effects(compute.power=T)... Error: Unimplemented feature in rep> .Traceback[[1]] [1] "rep(no, length = length(ans))" [[2]] [1] "ifelse(t.howto == \"n\", boot.result, l.meanboot.test(onew.x, onew.y, " " samples = boot.test.samples, expect = makezero, return.htest = T, " [3] " alt = \"t\"))" [[3]] [1] "measure.power(firstset, secondset, t.howto = t.howto, var.equal = var.equal)" [[4]] [1] "FUN(X[[i]], ...)" [[5]] [1] "lapply(split(X, group), FUN, ...)" [[6]] [1] "tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power)" [[7]] [1] "as.list(X)" [[8]] [1] "lapply(as.list(X), FUN, ...)" [[9]] [1] "sapply(tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power), " " rbind)" [[10]] [1] "t(sapply(tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power), " " rbind))" [[11]] [1] "do.summarize.effects(compute.power = T)" My problems are the following: 1. I cannot find the line rep(no, length = length(ans)) anywhere in my own code 2. The R source code of 'rep' does not contain the error message "unimplemented feature" (I have not checked the .Internal) 3. I've had similar strange errors before and could not find the problem in my own code. The problem finally went away after I renamed two of the groups in my data such that the factor ordering changed and the computations were performed in a different order... 4. I've also previously had the effect that my function that reads the data using read.table(), which is not part of the above call, reproducibly came up with the second column being NULL instead of 1451 items as the other colums. A second call to the same function reliably came back with the correct result. I am not sure whether these problems are related but I think both were not my fault. Any suggestions where to look for the above problem? Both my data and my computations are somewhat lengthy so the stepwise-stripping-down approach is cumbersome. The new problem appeared using the same data as in (3) above, but after some extensions to the code (none of them introducing a new call to rep()). The problem does also appear if I use only the small subset of the data used in the respective part of the computation that fails. Thanks in advance for your help Lutz Lutz Prechelt http://wwwipd.ira.uka.de/~prechelt/ | Whenever you Institut f. Programmstrukturen und Datenorganisation | complicate things, Universitaet Karlsruhe; D-76128 Karlsruhe; Germany | they get (Phone: +49/721/608-4068, FAX: +49/721/608-7343) | less simple.>>> Ever had negative research results? http://wwwipd.ira.uka.de/fnr <<<--please do not edit the information below-- Version: platform = alpha-dec-osf4.0 arch = alpha os = osf4.0 system = alpha, osf4.0 status = status.rev = 0 major = 0 minor = 64.1 year = 1999 month = May day = 8 language = R Search Path: .GlobalEnv, Autoloads, package:base -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian D Ripley
1999-Aug-23 20:19 UTC
Strange 'Unimplemented feature in rep' error (PR#254)
On Mon, 23 Aug 1999 prechelt@ira.uka.de wrote:> I have a large computation that performs various bootstrap resampling > loops over pairs of samples using lapply(). > After a few seconds it stops like this > > > do.summarize.effects(compute.power=T) > ... > Error: Unimplemented feature in rep > > .Traceback(use traceback(): it is easier to read)> [[1]] > [1] "rep(no, length = length(ans))" > > [[2]] > [1] "ifelse(t.howto == \"n\", boot.result, l.meanboot.test(onew.x, onew.y, " " samples = boot.test.samples, expect = makezero, return.htest = T, " > [3] " alt = \"t\"))" > > [[3]] > [1] "measure.power(firstset, secondset, t.howto = t.howto, var.equal = var.equal)" > > [[4]] > [1] "FUN(X[[i]], ...)" > > [[5]] > [1] "lapply(split(X, group), FUN, ...)" > > [[6]] > [1] "tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power)" > > [[7]] > [1] "as.list(X)" > > [[8]] > [1] "lapply(as.list(X), FUN, ...)" > > [[9]] > [1] "sapply(tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power), " " rbind)" > > [[10]] > [1] "t(sapply(tapply(1:nrow(dd), grouping, summarize.effects, compute.power = compute.power), " " rbind))" > > [[11]] > [1] "do.summarize.effects(compute.power = T)" > > My problems are the following: > > 1. I cannot find the line > rep(no, length = length(ans)) > anywhere in my own codeLook at the line below in the traceback: it is in ifelse.> 2. The R source code of 'rep' does not contain the error message > "unimplemented feature" (I have not checked the .Internal)Look in src/main/seq.c. It means that the first arg of rep is an unimplemented type of SEXP. It is hard to guess what: it checks that it is a vector or list.> 3. I've had similar strange errors before and could not find the problem > in my own code. The problem finally went away after I renamed two > of the groups in my data such that the factor ordering changed and > the computations were performed in a different order...Usually these indicate a problem with something being empty. What exactly does l.meanboot.test return, under all possible inputs? Your code is trying to replicate whatever it does return (omitting NAs), and failing. In the absence of a post-mortem debugger in R, traceback() is a very useful tool, worth getting to grips with. I grepped the sources to find the error message, something I resort to not infrequently. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._