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

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Fri, 22 Apr 2011 12:20:41 +0200

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.



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. Received on Fri 22 Apr 2011 - 10:23:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 10:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive