[R] attaching directories in R?

About this list Date view Thread view Subject view Author view

Agustin Lobo (alobo@ija.csic.es)
Thu, 15 Jul 1999 12:17:58 +0200 (MET DST)



Hi!

I'm trying to use R. In S+ I use to have different projects
in different directories. To make
the functions and other objects
from a directory available
and to use that directory as default,
I just do:

attach(directory, pos = 1)

where directory is, for example,

"/home/alobo/S/bolivia1"

Acutually, I have a simpe function
(work) to do this:

> work
function(directorio)
{
        if(any(search() == directorio))

                detach(what = directorio)

        attach(directorio, pos = 1)

        options(prompt = paste("Splus/", paste(directorio, ">", sep = ""),
sep = ""))

        search()
}

And I have a simpe function for each directory, i.e.,
for directory $home/Sutil

> util

function()
{

        work(paste(home, "/Sutil", sep = ""))
}

Now, if I try to do the same in R, I get:

> util()
Error: attach only works for lists and data frames

How could I do the equivalent function in R?

Thanks

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
http://pangea.ija.csic.es/alobo

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Tue 04 Jan 2000 - 13:33:56 EST