[R] Mac GUI and .Renviron
jwegelin at vcu.edu
Fri Oct 5 23:17:18 CEST 2007
The .Renviron and .First functions do not seem to work the same way on a
Mac OS 10.4 as on a Windows XP machine.
From working in Windows I am used to creating a new directory for each
data analysis project. In the new directory I place
First, an .Renviron file consisting of the following text:
Second, an .RData file containing a .First function designed for the
Then each project has, in its own directory, its own history.txt file of
practically unlimited size recording each command I type; I can open a
separate instance of R for each project by doubleclicking .RData in the
appropriate directory; and the .First function for a particular project
is run automatically each time I doubleclick .RData in the directory for
Now that I am on a Mac, the .RData file is invisible in Finder so I
can't doubleclick it. Typing
at the command line in the directory where a particular .RData resides
does not, for some reason, start up an R GUI session or any other
session. A little window opens up for an instant and goes away, and
subsequently no R job is running.
So as a workaround I type at the unix command line in the directory for
a given project
cp -p .RData temp.RData
and then in Finder I doubleclick temp.RData. Then an R GUI session opens
up. But this approach has the following limitations.
(a) .First function has not been run. I must manually type .First() at
the R prompt.
(b) The commands I type at the R prompt do not go into history.txt.
(c) A brand new .Rhistory file is created, clobbering any previously
existing .Rhistory file.
(d) The commands I type at the R prompt do not go into .Rhistory. That
is, after I quit R with the option "save workspace image", the brand new
.Rhistory file in my directory does not contain the commands I typed.
Is R supposed to act this way?
An alternate way to run R is to type "R" at the command line. This does
not open the GUI. And with this way of running R, there does not appear
to be any easy way to get interactive graphics.
Is there a more convenient or effective way to run R on a Mac?
Thanks for any suggestions.
OS X version 10.4.10
Processor 2.4 GHz Intel Core 2 Duo
Memory 4 GB 667 MHz DDR2 SDRAM
system i386, darwin8.9.1
svn rev 42083
version.string R version 2.5.1 (2007-06-27)
Jacob A. Wegelin
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
jwegelin at vcu dot edu
More information about the R-help