[R] How do you organize the objects you produced?

Rikkoe@softhome.net
Mon, 25 Mar 2002 20:26:38 -0000

Hello!

It would be nice to hear how you organize the R-objects you produced. I
found almost nothing about that neither in the R-manuals nor in two books
about S.

For example I am trying to find out, how to load the functions that I have
written and that are now saved in a .txt-file in a Windows directory. Is
copying and pasting it to the RGui console really the only feasible way to
do that? Constructing packages, similar to the ones included in the basic R
system, is probably too complicated for a beginner like me, isn?t it?

I wonder why manuals and books just explain how to write functions, but not
how to keep and to reload them. I have got a similar problem with my data. I
understood (mistakenly?) that one can attach a Windows directory to the
search path, so that every file inside this directory is known by R, without
further need to specify the path. So I tried:

> attach("C:\\Temp",2)
Error in load(file, envir) : unable to open file
> search()
[1] ".GlobalEnv"    "file:C:\\Temp"
"package:ctest" "Autoloads"
[5] "package:base"


Temp is a directory and includes a file named test.dat. I went on:

> file <- read.table("test.dat", header = TRUE, fill = TRUE)
Error in file(file, "r") : cannot open file `test.dat'


This last command only works when I use the RGui-menu to change my working
directory to Temp.

I feel I am using R as if cutting hair with a spoon. Do you know a nicer way
to use it?

Michael