Skip to content

Rterm does not load personal library

4 messages · Bond, Stephen, Uwe Ligges

#
Greetings,

I am trying to run a short script from a shell:

c:\projects\hell>Rscript --default-packages=mypack X:/4Stephen/commit/curve.R > X:/4Stephen/commit/run1.out

Loading required package: utils
Warning message:
package 'RODBC' was built under R version 2.12.2 
Error: could not find function "normalize"
Execution halted
Warning message:
closing unused RODBC handle 1

function 'normalize' is in "mypack" and I even attempt to load it from inside the script:

## curve.R
dt <- Sys.Date()
library(RODBC)
pipe <- odbcConnect("commit")
library(mypack) # with quotes it's the same result
normalize(pipe)

any ideas how to make Rterm load the library?? Running from inside ESS works fine. Also from RGui. It does not work if I start a session by "R -vanilla" on the command line.

Thanks and happy holidays.

Stephen
#
On 21.12.2012 18:16, Bond, Stephen wrote:
I guess some dependencies on other base R packages are not declared and 
those packages are not loaded by your package.
If you start RGui some packages are loaded that are not loaded if you 
start via --vanilla, but we cannot know more without information about 
mypack.

Uwe Ligges
#
Uwe,

Thank you for the suggestion. I checked and there are no dependencies involved. 
I discovered the problem is calling an old version

c:\projects\hell>which Rscript
which Rscript
/cygdrive/c/Program Files/R/R-2.12.1/bin/Rscript

Mypack is installed under 2.15.

Will change my paths and that should fix it.
Would be nice if Rscript produced a message saying it could not find the lib.

It returns nothing so it looks like the load worked, while it did not:

c:\projects\hell>R --vanilla
R --vanilla

R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)
library(RODBC)
Warning message:
package 'RODBC' was built under R version 2.12.2
library(mypack)
normalize
Error: object 'normalize' not found
Execution halted


Stephen 

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Friday, December 21, 2012 1:01 PM
To: Bond, Stephen
Cc: r-help at r-project.org
Subject: Re: [R] Rterm does not load personal library
On 21.12.2012 18:16, Bond, Stephen wrote:
I guess some dependencies on other base R packages are not declared and 
those packages are not loaded by your package.
If you start RGui some packages are loaded that are not loaded if you 
start via --vanilla, but we cannot know more without information about 
mypack.

Uwe Ligges
#
I have to apologize to everybody. The thing was failing because my library did not have that particular function in R 2.12.
The library actually loads fine, just the function is missing.

Merry Christmas to those celebrating.

Stephen 

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Friday, December 21, 2012 1:01 PM
To: Bond, Stephen
Cc: r-help at r-project.org
Subject: Re: [R] Rterm does not load personal library
On 21.12.2012 18:16, Bond, Stephen wrote:
I guess some dependencies on other base R packages are not declared and 
those packages are not loaded by your package.
If you start RGui some packages are loaded that are not loaded if you 
start via --vanilla, but we cannot know more without information about 
mypack.

Uwe Ligges