Strange 'Unimplemented feature in rep' error (PR#254)
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Mon, 23 Aug 1999 21:19:24 +0100 (BST)
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 code
Look 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._