tryCatchLog icon indicating copy to clipboard operation
tryCatchLog copied to clipboard

Documentation on how to keep source code references (line numbers) in installed packages seems non-working

Open aryoda opened this issue 4 years ago • 1 comments

To show the file name and line number that has thrown a condition the current documentation at github says:

enable the keep.source.pkgs option before (you install the packages!)

It seems that this does not work, at least not if I use install.packages as-is:

install.packages("data.table")

What seems to work is:

install.packages("data.table", INSTALL_opts = "--with-keep.source")

The reason seems to be that install.packages calls R CMD INSTALL internally.

Adding the option to .Rprofile seems to work keeping the source references (tested with R 3.6.1).

What should work: Setting the environment variable R_KEEP_PKG_SOURCE to yes (see ?options for the option keep.source.pkgs).

See also:

https://stackoverflow.com/a/50268331

https://cran.r-project.org/doc/manuals/R-exts.html#Dynamic-pages

keep.source=TRUE Whether to keep the author’s formatting when displaying the code, or throw it away and use a deparsed version.

https://cran.r-project.org/doc/manuals/R-exts.html#Tidying-R-code

aryoda avatar Jun 09 '21 13:06 aryoda

May be done together with #48 and added to the best practices

aryoda avatar Jul 31 '22 16:07 aryoda