[Rd] traceback does not show source line number of long calls when truncating output
Renaud Gaujoux
renaud at mancala.cbio.uct.ac.za
Mon May 12 09:51:44 CEST 2014
Hi,
in R-3.1.0 (Linux), traceback() does not show the source file line
number for the truncated calls, when limiting the number of lines
output for each call with argument max.lines. See sample code, output
and session info below (in particular, output for call number 5).
I guess this is not intended.
Thank you.
Bests,
Renaud
####################
## File: traceback.R
a <- function(...){ stop('this is an error') }
# code to generate the long call
# set.seed(123)
# v <- unique(replicate(10, { paste0(sample(letters[1:26]), collapse = "") }))
# sprintf("a(%s)", paste0(v, '=', 1, collapse = ", "))
a(htjuwakqxzpgrsbncvyofdmeli=1, ozgdvsnpaimweybtkulrhcfjxq=1,
udnecprhlbgwtfjisyzoxaqmvk=1, jcfpzqyirwotbsehdngauxlkvm=1,
mwvojdsfbqlchznegyirpkautx=1, qwzxlnyorhegackmvubfsjtipd=1,
ofkylhmugjvdwzscirnexptbqa=1, sgolfwzrevpjnythbqxmdckuai=1,
ezlfyoangrspdmihtuxkvwcbqj=1, gjetdqkmvwxufslhcbpirnazoy=1)
####################
####################
## In R
source('traceback.R', keep.source = TRUE)
traceback()
traceback(max.lines = 2)
sessionInfo()
####################
####################
## Output
> source('traceback.R', keep.source = TRUE)
Error in a(htjuwakqxzpgrsbncvyofdmeli = 1, ozgdvsnpaimweybtkulrhcfjxq = 1, :
this is an error
> traceback()
6: stop("this is an error") at traceback.R#1
5: a(htjuwakqxzpgrsbncvyofdmeli = 1, ozgdvsnpaimweybtkulrhcfjxq = 1,
udnecprhlbgwtfjisyzoxaqmvk = 1, jcfpzqyirwotbsehdngauxlkvm = 1,
mwvojdsfbqlchznegyirpkautx = 1, qwzxlnyorhegackmvubfsjtipd = 1,
ofkylhmugjvdwzscirnexptbqa = 1, sgolfwzrevpjnythbqxmdckuai = 1,
ezlfyoangrspdmihtuxkvwcbqj = 1, gjetdqkmvwxufslhcbpirnazoy = 1)
at traceback.R#8
4: eval(expr, envir, enclos)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("traceback.R", keep.source = TRUE)
> traceback(max.lines = 2)
6: stop("this is an error") at traceback.R#1
5: a(htjuwakqxzpgrsbncvyofdmeli = 1, ozgdvsnpaimweybtkulrhcfjxq = 1,
udnecprhlbgwtfjisyzoxaqmvk = 1, jcfpzqyirwotbsehdngauxlkvm = 1,
...
4: eval(expr, envir, enclos)
3: eval(ei, envir)
2: withVisible(eval(ei, envir))
1: source("traceback.R", keep.source = TRUE)
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
>
More information about the R-devel
mailing list