Skip to content
Back to formatted view

Raw Message

Message-ID: <efb536d50612201206s15bef8b3sa8736f4af102f1c2@mail.gmail.com>
Date: 2006-12-20T20:06:08Z
From: Sarah Goslee
Subject: writing R extension
In-Reply-To: <20061220193004.51714.qmail@web37903.mail.mud.yahoo.com>

Hi,

> I am dealing with the same issue here and I was wondering whether it would be possible to just save
> the R compliled function objects in a directory and just attach the directory to the search path.
> (I am using R2.4.0+ESS+Xemacs in windows XP).


The other method that I'm familiar with uses save() and load() rather than
attach. It may be possible to use attach() in some other method.

> temp1 <- function(x) {x * x}
> temp2 <- function(x) {x + x}
> temp1(3)
[1] 9
> temp2(3)
[1] 6
> save(list=ls(), file="testfns")
> q(save="no")

# start R
> ls()
character(0)
> load("testfns")
> ls()
[1] "temp1" "temp2"


My personal preference is the text source file approach, but opinions
obviously vary on that. I do keep "final" versions in a package.

And yes, the proper term is package, but it seems that if the entity
in question is stored in  /usr/lib/R/library (on my linux system), and
loaded with the function library() the occasional slip might be forgiven?

Sarah
-- 
Sarah Goslee
http://www.stringpage.com
http://www.functionaldiversity.org