[R] attaching directories in R?

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


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,


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

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

		detach(what = directorio)

	attach(directorio, pos = 1)

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


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

> util


	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?


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

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