Skip to content
Prev 10380 / 398503 Next

newbie questions: accessing functions globally

On Monday 26 March 2001 01:36, Patrick Connolly wrote:

            
I haven't played with R_ENVIRON yet. I'm sure it could be used to the same 
effect, though. Your idea doesn't sound silly. Let's see...

pflugs at Aconitum:~ > R --vanilla   # start with an empty workspace

R : Copyright 2001, The R Development Core Team
Version 1.2.2  (2001-02-26)

[...]

Type `q()' to quit R.
gives a .RData file with just .First() in it. If we copy this into a new 
directory, R should load it automagically when started in that directory and 
execute the .First function:
pflugs at Aconitum:~ > mkdir RTest
pflugs at Aconitum:~ > cp .RData RTest
pflugs at Aconitum:~ > cd RTest/
pflugs at Aconitum:~/RTest > R

R : Copyright 2001, The R Development Core Team
Version 1.2.2  (2001-02-26)

[...]

[Previously saved workspace restored]
[1] ".GlobalEnv"                         "file:/home/pflugs/R/my.functions.R"
[3] "Autoloads"                          "package:base"  

works as expected. I think I'll use this in the future. Thanks for the idea!

Cheers

Kaspar