[ESS-bugs] debug(unique.default) -- and "hell breaks loose" ;-)
Martin Maechler
maechler at stat.math.ethz.ch
Fri Sep 26 12:17:38 CEST 2014
The subject is jokingly,
but watch :
M-x R freshly, then in the *R* buffer :
Note the browse level [14] (!!) and then the huge call stack :
---------------------------------------------------------------------
> debug(unique.default)
> unique(diag(4))
[,1] [,2] [,3] [,4]
[1,] 1 0 0 0
[2,] 0 1 0 0
[3,] 0 0 1 0
[4,] 0 0 0 1
Browse[14]>
debug: if (is.factor(x)) {
z <- .Internal(unique(x, incomparables, fromLast, min(length(x),
nlevels(x) + 1L)))
return(factor(z, levels = seq_len(nlevels(x)), labels = levels(x),
ordered = is.ordered(x)))
}
Browse[14]> sys.calls()
[[1]]
.ess_funargs("unique")
[[2]]
Ops.numeric_version(.ess.Rversion, "2.14.1")
[[3]]
as.numeric_version(e2)
[[4]]
numeric_version(x)
[[5]]
.make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version)
[[6]]
unique(c(classes, "numeric_version"))
[[7]]
unique.default(c(classes, "numeric_version"))
[[8]]
.ess_funargs("unique")
[.................................]
[.................................]
[[49]]
unique.default(c(classes, "numeric_version"))
Browse[14]>
----------
Yes, it is because our R code ESSR also calls unique() ->
unique.default() ...
But it is very unfortunate, of course, if I really want to debug
to which unique() method R dispatches, and that is what I had
wanted to do.
Martin
More information about the ESS-bugs
mailing list