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: R_HISTFILE="history.txt" R_HISTSIZE=1000000 Second, an .RData file containing a .First function designed for the particular project. 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 that project. Now that I am on a Mac, the .RData file is invisible in Finder so I can't doubleclick it. Typing open .RData 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. Mac specs: OS X version 10.4.10 Processor 2.4 GHz Intel Core 2 Duo Memory 4 GB 667 MHz DDR2 SDRAM R specs:> version_ platform i386-apple-darwin8.9.1 arch i386 os darwin8.9.1 system i386, darwin8.9.1 status major 2 minor 5.1 year 2007 month 06 day 27 svn rev 42083 language R version.string R version 2.5.1 (2007-06-27) Jacob A. Wegelin Assistant Professor Department of Biostatistics Virginia Commonwealth University 730 East Broad Street Room 3006 P. O. Box 980032 Richmond VA 23298-0032 U.S.A. http://www.people.vcu.edu/~jwegelin jwegelin at vcu dot edu
Hi Jake This might work for you: You can make hidden files visible in the Mac Finder by issuing the following command in a *nix shell window: in the Terminal type: defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder (see e.g. http://www.osxfaq.com/DailyTips/02-2005/02-01.ws) Now in Finder, <Control>-click on a .Rdata file and do "Open with" and navigate to R.app You can associate .Rdata files with R.app in the Info window which can be raised e.g. by <Control>-clicking on .Rdata and selecting "Get Info" on the pop-up menu. I'm not sure this will all work, but may enable you to figure out a Mac approach. You might also want to query the R-SIG-Mac group and check their archives. Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -----Original Message----- From: r-help-bounces at r-project.org on behalf of jwegelin Sent: Fri 10/5/2007 2:17 PM To: r-help at r-project.org Subject: [R] Mac GUI and .Renviron 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: R_HISTFILE="history.txt" R_HISTSIZE=1000000 Second, an .RData file containing a .First function designed for the particular project. 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 that project. Now that I am on a Mac, the .RData file is invisible in Finder so I can't doubleclick it. Typing open .RData 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. Mac specs: OS X version 10.4.10 Processor 2.4 GHz Intel Core 2 Duo Memory 4 GB 667 MHz DDR2 SDRAM R specs:> version_ platform i386-apple-darwin8.9.1 arch i386 os darwin8.9.1 system i386, darwin8.9.1 status major 2 minor 5.1 year 2007 month 06 day 27 svn rev 42083 language R version.string R version 2.5.1 (2007-06-27) Jacob A. Wegelin Assistant Professor Department of Biostatistics Virginia Commonwealth University 730 East Broad Street Room 3006 P. O. Box 980032 Richmond VA 23298-0032 U.S.A. http://www.people.vcu.edu/~jwegelin jwegelin at vcu dot edu ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Jacob, As Steven mentioned, R-SIG-Mac at stat.math.ethz.ch is a list specific for OSX only questions. I think you can achieve something similar by going into the preference settings of R.app, select the Startup section and select 'Source input file', de-select 'Always apply' and make the R history file something like 'Rhistory', no fixed path. You can up the number of history entries, although with R.app's multiline history and with 'Cleanup history entries' and ' Remove duplicate entries in history' selected, 250 in a GUI is in many cases a lot. In Finder, double-click an .R file you want to work on (or drag its icon onto the R icon in the Dock), R will open in the dir of the file and read the correct history file. It will open the double-clicked or dragged file in either the internal or external editor, whichever one is selected. I do not think you can, without some further steps, run multiple R.apps at the same time. Let me know if that is critical for you. Hope this helps, regards, Rob On Oct 5, 2007, at 2:17 PM, jwegelin wrote:> > 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: > > R_HISTFILE="history.txt" > R_HISTSIZE=1000000 > > Second, an .RData file containing a .First function designed for the > particular project. > > 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 > that project.
On 7/10/07 3:49 AM, Rob J Goedman wrote: > I do not think you can, without some further steps, run multiple > R.apps at the same time. Let me know if that is critical for you. If you copy R.app, you can run each copy concurrently. James -- James Reilly Department of Statistics, University of Auckland Private Bag 92019, Auckland, New Zealand