[R] attaching directories in R?

Agustin Lobo alobo at ija.csic.es
Thu Jul 15 12:17:58 CEST 1999


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 at 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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list