HenrikBengtsson / profmem

šŸ”§ R package: profmem - Simple Memory Profiling for R
https://cran.r-project.org/package=profmem
35 stars 2 forks source link

VIGNETTE: Integers `5000L` in code snippets are displayed as `5000` #3

Closed HenrikBengtsson closed 8 years ago

HenrikBengtsson commented 8 years ago

Integers 5000L in code snippets are displayed as 5000. This is due to a limitation in R.utils::withCapture();

> R.utils::withCapture(list(a=5000, b=5000L))
> list(a = 5000, b = 5000L)
$a
[1] 5000
$b
[1] 5000

which in turn is due to a limitation to how print() outputs integers;

> list(a = 5000, b = 5000L)
$a
[1] 5000
$b
[1] 5000
> 5000
[1] 5000
> 5000L
[1] 5000
HenrikBengtsson commented 8 years ago

Hmm... it works in interactive mode

> sQuote(R.utils::withCapture(x <- 1L))
[1] "ā€˜> x <- 1L\nā€™"

but not in non-interactive / batch mode:

$ Rscript -e "sQuote(R.utils::withCapture(x <- 1L))"
[1] "ā€˜> x <- 1\nā€™"

The latter is how the vignette (and README) is built.

HenrikBengtsson commented 8 years ago

Solved manually in the vignette. Moved the underlying issue to https://github.com/HenrikBengtsson/R.utils/issues/58.