[R] Package check issue: Rprofile.site is not used

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Apr 22 12:20:41 CEST 2011


See ?Startup:

   ‘R CMD check’ and ‘R CMD build’ do not always read the standard
      startup files, but they do always read specific ‘Renviron’ files
      such as ‘~/.R/check.Renviron’, ‘~/.R/build.Renviron’ or
      sub-architecture-specific versions.

Uwe Ligges



On 21.04.2011 22:48, Sébastien Bihorel wrote:
> Dear R-users,
>
> I am having some issues with a package I am working on (using R 2.12.1 in a
> Linux environment) and would like to have your opinions/advises. My package
> - let's call it mypackage for the purpose of this email - passes all checks
> of R CMD check, except for the following failure message:
>
> Error : .onLoad failed in loadNamespace() for 'mypackage', details:
>    call: source(file = options()$my_path, local = TRUE)
>    error: invalid connection
> Error: package/namespace load failed for 'mypackage'
> Execution halted
>
> The context is the following:
>
> 1- /usr/lib/R/etc/Rprofile.site contains the following line of R code:
> options(my_path='/some/path/
> to/myfile.txt')
>
> 2- mypackage has a NAMESPACE, and a .onLoad function is included in a zzz.R
> file. Its content is the following:
>
> .onLoad<- function(libname, pkname) {
>    # print(options()) # for testing
>    myf()
> }
>
> 3- myf is a function distributed with mypackage. At one point of its
> execution, this function tries to source /some/path/to/myfile.txt using the
> following call: source(file = options()$my_path, local = TRUE)
>
> When I start as R session and call 'options()$mypath', I get the expected
> output: '/some/path/to/myfile.txt'. When I uncomment the 'print(options())'
> line in .onLoad and try a R CMD check, mypath does not appear as a level of
> options(). Overall, it looks like my Rprofile.site is not used when R CMD
> check is run. Is there a way I could request R to use my Rprofile.site
> during a package check?
>
> Thank you in advance.
>
> Sebastien
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list