Rob,

On Wed, Mar 31, 2004 at 05:28:19PM -0500, Kissell, Robert [EQRE] wrote:
> 1) I have a ".First" function that automatically loads the quadprog package into the 
> workspace. The .First function resides in R and is only saved if I save the 
> workspace. The exact function is as follows:
[...]
> Is there any way that this function can be saved outside of R? That is, is there any 
> procedure that will run specified R commands whenever R is invoked?

Try help(Startup) 

You probably want .Rprofile (on a per-directory basis), and/or the site-wide
$R_HOME/etc/Rprofile.
 
 
> 2) Is there anyway to specify additional paths for R to search. For example, I have 
> some R script named, myProg.r that is saved in a directory 
> C:\Programs\RLanguage\Rob\. I run the script in the following way:
>       source("C:/Programs/RLanguage/Rob/myProg.r")
>
>  This works fine, but I was wondering if there is any command that could be entered 
> into the .First function described above that adds the directory 
> C:\Programs\RLanguage\Rob\ to the R path. This way, C:\Programs\RLanguage\Rob\ will 
> always be checked for the code and I could simply run myProg.r as follows:
>       source("myProg.r")

For library(), there is an argumemnt lib.loc. You can also set things from 
Rprofile.

Source is simpler and wants pathname, so maybe you want to write a local function
that does your desired magic with the directory and appends the filename you
supply, before calling source() on the combined string?

> 3) Is there anyway that I could save functions that I have written outside of R. 
> That is, could I write functions and have them saved in some directory, such as, 
> C:\Programs\RLanguage\RobFunctions\? This way I would be able to copy the functions 
> to other pcs. This is very simple in MatLab. Please let me know.

See 2), save() and friends have pathnames too. So
save("N:/my/network/share/foo.R") works just fine.

Hth, Dirk


-- 
The relationship between the computed price and reality is as yet unknown.  
                                             -- From the pac(8) manual page

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to