Using --vanilla with R CMD build

喜夏-厌秋 提交于 2019-12-11 09:49:42

问题


According to the document Writing R Extensions ss 1.3 "R CMD check and R CMD build run R with --vanilla, so none of the user's startup files are read".

This doesn't seem to happen on my installation. I have found that my version of R (2.15.1 on Mac) loads the packages in my .Rprofile - i am pretty sure about this, as i've managed to reliably break it by adding library(hobblegobble) to my .Rprofile.

does this matter? If so, should i always prefer to build packages with

R --vanilla CMD build

thanks


回答1:


You can use either R --vanilla CMD build myPackage or R --vanilla CMD INSTALL --build myPackage if your .Rprofile loads packages that you are trying to build (or install).

The only drawback I am aware of to using --vanilla is that the terminal's completion (i.e. having the package directory name completed for you when you tap tab) may not work while you're typing the path to the package directory.

However, a better solution may be to wrap if (interactive()) {} around code in your .Rprofile that you only want to be run in interactive sessions. e.g. library or require calls.

In your case if your .Rprofile had if (interactive()) library(hobblegobble) you wouldn't need to use --vanilla.



来源:https://stackoverflow.com/questions/11638147/using-vanilla-with-r-cmd-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!