Sébastien Bihorel
2011-Apr-21 20:48 UTC
[R] Package check issue: Rprofile.site is not used
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]]
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.
Seemingly Similar Threads
- llvm-link: Missing Dwarf DIE references
- The fastest way to select and execute a few selected functions inside a function
- Discrepancies in run times
- Calling the curve function with a character object converted into an expression
- how Can make function for selecting the products