R-Sessions 29: Running R-Project twice on Apple Mac OS X


Working with statistics can be quite time consuming. As anyone working with relatively advanced models and large amounts of data knows, especially the waiting can be excruciating. Your statistical software is locked up while crunching those numbers, while you’d actually prefer to run some minor procedures, such as post-estimations, testing some loops, or simply displaying the output of a previously estimated model. With Apple’s Mac OS X you now can run R-Project twice, making the most of your dual core processor.

The procedure is very easy, and it works like a charm. Mind though that, obviously, it drains your computers’ resources heavily, so performance of each instance of R-Project decreases slightly at least. For that to change, we would need dual-hard disk laptops, and dual-RAM laptops and the such. Dual laptop-laptops basically.

Back to running R-Project twice. Just start R-Project as usual. Then go to your applications folder and secondary-click on the R-Project app. Select ‘duplicate’, and there you are: an app named R copy emerges. Start this as usual and start working.

in the image below you see two instances of R-Project running. The first is working on a heavy-weight function that results in some output every hour or so and runs 96 times. In other words: it takes ages. However, it stores the output in an external file, and since each little bit of output needs some post-estimation before being interpreted, I can use the second instance to load that data and examine it (not shown).

Although you don’t need to re-install packages, the only thing I did not (yet) find out how to do is to share resources between these two instances of R-Project. Being able to share variables, models, and such would be great. Ideas anyone?

– – — — —– ——–

– – — — —– ——–
R-Sessions is a collection of manual chapters for R-Project, which are maintained on Curving Normality. All posts are linked to the chapters from the R-Project manual on this site. The manual is free to use, for it is paid by the advertisements, but please refer to it in your work inspired by it. Feedback and topic requests are highly appreciated.
——– —– — — – –

6 comment on “R-Sessions 29: Running R-Project twice on Apple Mac OS X

  • Hi Rense,
    great work – the R Sessions! Thanks.
    To start multiple instances of R was just what I have been looking for since quite some time.
    Thanks for the hint.
    Mark

  • hi rense,
    can u please tell me how to run the r program on in MACbook air.
    i mean tell me the key i have to press in order to run some commands.

  • You can run several instances of R via the terminal. Just start one or several
    terminal windows, type R and type or copy your R code.

  • Hi Rense,

    As I see you know a lot about mac and R. Well, I am a beginner in R(R.3.0.1 GUI) and in mac (mac book Pro bought on may). I am trying to run an advanced process (FrailtyPenal) with a larga dataset (300,000 rows and 40 columns) and I can not, it starts running and after three minutes it says: “the boot disk is full”. The working directory is an external disk. I do not have a lot of programs neither files in the laptot. Please, do you know what I can do, maybe I have to cancel some processes, I do not know which of then can be cancelled, or I should by another SSD…..
    I would appreciate your answer because I need to continue with my research.
    Thank you so much!

Leave a Reply