Rev 568 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<html lang="en"><head><title>R for Mac OS X FAQ</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><meta name="description" content="R for Mac OS X FAQ"><meta name="generator" content="makeinfo 4.6"><meta http-equiv="Content-Style-Type" content="text/css"><style type="text/css"><!--pre.display { font-family:inherit }pre.format { font-family:inherit }pre.smalldisplay { font-family:inherit; font-size:smaller }pre.smallformat { font-family:inherit; font-size:smaller }pre.smallexample { font-size:smaller }pre.smalllisp { font-size:smaller }--></style></head><body><h1 class="settitle">R for Mac OS X FAQ</h1><div class="node"><p><hr>Node: <a name="Top">Top</a>,Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>,Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>,Up: <a rel="up" accesskey="u" href="#dir">(dir)</a><br></div><h2 class="unnumbered">R for Mac OS X FAQ</h2><h2>Frequently Asked Questions on R for Mac OS X</h2><h2>Version 2.0-0 2004-10-10</h2><address>Stefano M. Iacus</address><address>Simon Urbanek</address><p><p><hr><p><ul class="menu"><li><a accesskey="1" href="#Introduction">Introduction</a>:<li><a accesskey="2" href="#Building%20R%20from%20sources">Building R from sources</a>:<li><a accesskey="3" href="#Command%20line%20version%20of%20R">Command line version of R</a>:<li><a accesskey="4" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a>:<li><a accesskey="5" href="#How%20to%20install%20packages">How to install packages</a>:<li><a accesskey="6" href="#R%20and%20external%20applications">R and external applications</a>:<li><a accesskey="7" href="#The%20near%20future%20of%20the%20Aqua%20GUI">The near future of the Aqua GUI</a>:<li><a accesskey="8" href="#Aqua%20GUI%20Bugs">Aqua GUI Bugs</a>:<li><a accesskey="9" href="#Quartz%20device">Quartz device</a>:<li><a href="#TclTk%20issues">TclTk issues</a>:<li><a href="#Additional%20resources">Additional resources</a>:<li><a href="#Acknowledgments">Acknowledgments</a>:<li><a href="#Sparse%20questions">Sparse questions</a>:</ul><div class="node"><p><hr>Node: <a name="Introduction">Introduction</a>,Next: <a rel="next" accesskey="n" href="#Building%20R%20from%20sources">Building R from sources</a>,Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Introduction</h2><p>This R for Mac OS X FAQ is rather incomplete at the moment and requires contributions from users.Anything specific to the R language can be found in the official R-FAQ (see <a href="http://cran.r-project.org/doc/FAQ/R-FAQ.html">http://cran.r-project.org/doc/FAQ/R-FAQ.html</a>).Please send any requests/questions you would like answers on to the maintaniers.<p>This document contains information on how to build <small>R</small> from sources, how to install and run it.It also contains a user guide to the Aqua GUI version of <small>R</small>.<ul class="menu"><li><a accesskey="1" href="#How%20many%20versions%20of%20R%20for%20Mac%20OS%20X%3f">How many versions of R for Mac OS X?</a>:<li><a accesskey="2" href="#What%20machines%20does%20R%20for%20Mac%20OS%20X%20run%20on%3f">What machines does R for Mac OS X run on?</a>:<li><a accesskey="3" href="#How%20can%20R%20for%20Mac%20OS%20X%20be%20obtained%20and%20installed%3f">How can R for Mac OS X be obtained and installed?</a>:</ul><div class="node"><p><hr>Node: <a name="How%20many%20versions%20of%20R%20for%20Mac%20OS%20X%3f">How many versions of R for Mac OS X?</a>,Next: <a rel="next" accesskey="n" href="#What%20machines%20does%20R%20for%20Mac%20OS%20X%20run%20on%3f">What machines does R for Mac OS X run on?</a>,Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a><br></div><h3 class="section">How many versions of R for Mac OS X?</h3><p>There is currently only one version of R for Mac OS X.But R on Mac OS X can be used as a command-line application (see <a href="#Command%20line%20version%20of%20R">Command line version of R</a>), like on anyother unix-like system, or via the Aqua GUI (see <a href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a>). This second approach in using Rfor Mac OS X is mostly preferred by "traditional" Macintosh users.<div class="node"><p><hr>Node: <a name="What%20machines%20does%20R%20for%20Mac%20OS%20X%20run%20on%3f">What machines does R for Mac OS X run on?</a>,Next: <a rel="next" accesskey="n" href="#How%20can%20R%20for%20Mac%20OS%20X%20be%20obtained%20and%20installed%3f">How can R for Mac OS X be obtained and installed?</a>,Previous: <a rel="previous" accesskey="p" href="#How%20many%20versions%20of%20R%20for%20Mac%20OS%20X%3f">How many versions of R for Mac OS X?</a>,Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a><br></div><h3 class="section">What machines does R for Mac OS X run on?</h3><p>R for Mac OS X requires Mac OS X version 10.2 or higher to run. The latest version of the system isalways preferable though. We do not support Mac OS X version 10.1.<div class="node"><p><hr>Node: <a name="How%20can%20R%20for%20Mac%20OS%20X%20be%20obtained%20and%20installed%3f">How can R for Mac OS X be obtained and installed?</a>,Previous: <a rel="previous" accesskey="p" href="#What%20machines%20does%20R%20for%20Mac%20OS%20X%20run%20on%3f">What machines does R for Mac OS X run on?</a>,Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a><br></div><h3 class="section">How can R for Mac OS X be obtained and installed?</h3><div class="node"><p><hr>Node: <a name="Building%20R%20from%20sources">Building R from sources</a>,Next: <a rel="next" accesskey="n" href="#Command%20line%20version%20of%20R">Command line version of R</a>,Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Building R from sources</h2><ul class="menu"><li><a accesskey="1" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a>:<li><a accesskey="2" href="#How%20to%20configure%20and%20build%20R">How to configure and build R</a>:<li><a accesskey="3" href="#How%20to%20install%20R">How to install R</a>:<li><a accesskey="4" href="#How%20to%20build%20and%20install%20the%20Aqua%20GUI">How to build and install the Aqua GUI</a>:</ul><div class="node"><p><hr>Node: <a name="What%20is%20needed%20to%20build%20R">What is needed to build R</a>,Next: <a rel="next" accesskey="n" href="#How%20to%20configure%20and%20build%20R">How to configure and build R</a>,Up: <a rel="up" accesskey="u" href="#Building%20R%20from%20sources">Building R from sources</a><br></div><h3 class="section">What is needed to build R</h3><ul class="menu"><li><a accesskey="1" href="#the%20C%2fC++%20compiler%20gcc%203.3">the C/C++ compiler gcc 3.3</a>:<li><a accesskey="2" href="#the%20Fortran%20compiler%20g77%20for%20gcc%203.3">the Fortran compiler g77 for gcc 3.3</a>:<li><a accesskey="3" href="#the%20libreadline%204.3%20(optional)">the libreadline 4.3 (optional)</a>:<li><a accesskey="4" href="#the%20X11%20window%20server%20(optional)">the X11 window server (optional)</a>:<li><a accesskey="5" href="#the%20X11%20TclTk%20headers%20and%20libraries%20(optional)">the X11 TclTk headers and libraries (optional)</a>:<li><a accesskey="6" href="#the%20Aqua%20TclTk%20headers%20and%20libraries%20(optional)">the Aqua TclTk headers and libraries (optional)</a>:<li><a accesskey="7" href="#a%20TeX%20suite%20of%20tools%20for%20documentation%20(optional)">a TeX suite of tools for documentation (optional)</a>:</ul><div class="node"><p><hr>Node: <a name="the%20C%2fC++%20compiler%20gcc%203.3">the C/C++ compiler gcc 3.3</a>,Next: <a rel="next" accesskey="n" href="#the%20Fortran%20compiler%20g77%20for%20gcc%203.3">the Fortran compiler g77 for gcc 3.3</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the C/C++ compiler gcc 3.3</h4><p>If you have Mac OS X 10.3 (aka Panther) you just need to install the software inside the Xcode Tools CD(which is CD number 4). This is only true if you bought Panther. In most of the cases you havePanther already installed on your brand new machine, which means that you don't have the forthDeveloper CD. You should take it from Apple Developer Connection site (see <a href="#Apple%20Developer%20Connection">Apple Developer Connection</a>): in thedownload section, look for Xcode Tools v 1.1 or above.<p>If you are using Mac OS X 10.2 (aka Jaguar) then you should download and install theApple Developers Tools Dec 2002 including the latest updates which dates August 2003. Either it comeson a separate CD with your Mac, either you can download these from the Apple Developer Connection site (see <a href="#Apple%20Developer%20Connection">Apple Developer Connection</a>)In either cases be sure you have gcc version 3.3 just by typing in a Terminal window<pre class="example"> gcc -vv</pre><div class="node"><p><hr>Node: <a name="the%20Fortran%20compiler%20g77%20for%20gcc%203.3">the Fortran compiler g77 for gcc 3.3</a>,Next: <a rel="next" accesskey="n" href="#the%20libreadline%204.3%20(optional)">the libreadline 4.3 (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20C%2fC++%20compiler%20gcc%203.3">the C/C++ compiler gcc 3.3</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the Fortran compiler g77 for gcc 3.3</h4><p>You need to install a version of the g77 Fortran compiler which is built for gcc 3.3.The following instructions apply to binaries coming from HPC for Mac OS X page <a href="http://hpc.sourceforge.net">http://hpc.sourceforge.net</a>.Please take care: there are two versions of the g77 binaries, one for Jaguar and one for Panther.Use the appropriate one.<p>Once you have the binaries, please do the following (you'll be asked for a root password):cd to the download folder and type<pre class="example"> sudo tar -zxvf g77v3.4-bin.tar.gz -C /rehash</pre>It installs everything in <em>/usr/local</em>. The name of the .tar.gz archive can be different, see the related web page.<div class="node"><p><hr>Node: <a name="the%20libreadline%204.3%20(optional)">the libreadline 4.3 (optional)</a>,Next: <a rel="next" accesskey="n" href="#the%20X11%20window%20server%20(optional)">the X11 window server (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20Fortran%20compiler%20g77%20for%20gcc%203.3">the Fortran compiler g77 for gcc 3.3</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the libreadline 4.3 (optional)</h4><p>This library is optional.You need this library to be able to retrieve history using use arrow keys or for tab completion of filenameswhen you run R as a command line tool. The original source archive is located at GNU Org web page <a href="ftp://www.gnu.org">ftp://www.gnu.org</a>.You need to modify the original file <em>shlib/Makefile.in</em> in order to make itwork under Mac OS X 10.2.x and later (this is because libreadline needs to be linked against<em>-lncurses -lcc_dynamic</em>). If you can do better at configure time working on the original archivelet me know. I suggest you to download my patched version from <a href="http://www.economia.unimi.it/R">http://www.economia.unimi.it/R</a>.Once you have done, please do the following (you'll be asked for a root password):uncompress the archive, cd inside the folder and type the following<pre class="example"> ./configuremakesudo make install</pre>It installs everything in <em>/usr/local</em>.These instructions apply to both Jaguar and Panther.<div class="node"><p><hr>Node: <a name="the%20X11%20window%20server%20(optional)">the X11 window server (optional)</a>,Next: <a rel="next" accesskey="n" href="#the%20X11%20TclTk%20headers%20and%20libraries%20(optional)">the X11 TclTk headers and libraries (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20libreadline%204.3%20(optional)">the libreadline 4.3 (optional)</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the X11 window server (optional)</h4><p>If you have Panther, you probably have the X11 Window server already installed on your system.This is what you need to run a version of R with the capability of using the X11 device, but it isn't sufficientif you want to build it.You need to install the additional X11 SDK package from the Xcode Tools CD.Please note: the installer on the Xcode Tools CD does not install the X11 SDK by default:you should look inside the Xcode Tools CD and install manually the X11 SDK.<p>If you have Jaguar, you'll need to install both the X11 Window server and the X11 SDK package fromthe XFree86 web page. Apple site only supports the latest version of his OS (at the moment Panther).Users report that other version of X11 Window Servers (other than the one distributed by Apple) work as well.<div class="node"><p><hr>Node: <a name="the%20X11%20TclTk%20headers%20and%20libraries%20(optional)">the X11 TclTk headers and libraries (optional)</a>,Next: <a rel="next" accesskey="n" href="#the%20Aqua%20TclTk%20headers%20and%20libraries%20(optional)">the Aqua TclTk headers and libraries (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20X11%20window%20server%20(optional)">the X11 window server (optional)</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the X11 TclTk headers and libraries (optional)</h4><p>You need to download the sources of the Tcl and Tk 8.4.x packages to build yourself the sources.The original sources can be found on the official TclTk web page <a href="http://www.tcl.tk/software/tcltk/8.4.html">http://www.tcl.tk/software/tcltk/8.4.html</a>.Please do the following respecting the sequence (you'll be asked for a root password). These are examples for version 8.4.4of the Tcl and Tk sources, you'll probably find new version on the web page, thus only the name of the .tar.gz archiveschanges.<p>For Tcl: download the tlc 8.4 sources, cd inside the folder where you have downloaded the archive andtype:<pre class="example"> tar zxf tcl8.4.4-src.tar.gzcd tcl8.4.4/unix/./configuremakesudo make install</pre><p>For Tk: download the tk 8.4 sources, cd inside the folder where you have downloaded the archive and type:<pre class="example"> tar zxf tk8.4.4-src.tar.gzcd tk8.4.4/unix/./configuremakesudo make install</pre><div class="node"><p><hr>Node: <a name="the%20Aqua%20TclTk%20headers%20and%20libraries%20(optional)">the Aqua TclTk headers and libraries (optional)</a>,Next: <a rel="next" accesskey="n" href="#a%20TeX%20suite%20of%20tools%20for%20documentation%20(optional)">a TeX suite of tools for documentation (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20X11%20TclTk%20headers%20and%20libraries%20(optional)">the X11 TclTk headers and libraries (optional)</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">the Aqua TclTk headers and libraries (optional)</h4><p>Once you have installed the AquaTclTk libraries and headers files you should configure <small>R</small> using this additionalarguments<pre class="example"> --with-tcl-config=/Library/Frameworks/Tcl.framework/tclConfig.sh--with-tk-config=/Library/Frameworks/Tk.framework/tkConfig.shTCLTK_LIBS='-framework Tcl -framework Tk'TCLTK_CPPFLAGS='-I/Library/Frameworks/Tcl.Framework/Headers -I/Library/Frameworks/Tk.Framework/Headers'</pre><div class="node"><p><hr>Node: <a name="a%20TeX%20suite%20of%20tools%20for%20documentation%20(optional)">a TeX suite of tools for documentation (optional)</a>,Previous: <a rel="previous" accesskey="p" href="#the%20Aqua%20TclTk%20headers%20and%20libraries%20(optional)">the Aqua TclTk headers and libraries (optional)</a>,Up: <a rel="up" accesskey="u" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a><br></div><h3 class="subsection">a TeX suite of tools for documentation (optional)</h4><p>There is a nice installer, called the i-installer II, that allows you to install a completeteTeX distribution. You can find details on the i-installer at <a href="http://www.rna.nl/ii.html">http://www.rna.nl/ii.html</a>.The teTeX is one of the i-Packages.<div class="node"><p><hr>Node: <a name="How%20to%20configure%20and%20build%20R">How to configure and build R</a>,Next: <a rel="next" accesskey="n" href="#How%20to%20install%20R">How to install R</a>,Previous: <a rel="previous" accesskey="p" href="#What%20is%20needed%20to%20build%20R">What is needed to build R</a>,Up: <a rel="up" accesskey="u" href="#Building%20R%20from%20sources">Building R from sources</a><br></div><h3 class="section">How to configure and build R</h3><p>Download the latest sources of R from <small>CRAN</small>. Unpack the archive with tar -zxf <em>name_of_R_sources_archive</em> and cdinside the R sources directory. Then you need to configure R for your system and build R.Just type<pre class="example"> ./configure --with-blas='-framework vecLib' --with-lapack --with-aquamake</pre>This will configure R to be built as a Framework to be installed inside your <em>/Library/Frameworks</em> directory with the name<em>R.framework</em>. You can change the default location of the <em>R.framework</em>installation at configure time by specifying the flag <em>-enable-R-framework[=DIR]</em>, i.e.with something like<pre class="example"> ./configure --with-blas='-framework vecLib' --with-lapack--with-aqua --enable-R-framework=FOO</pre>and the final destination of the <em>R.framework</em> will be <em>FOO/R.framework</em>, which means that youdon't have to specify the <em>R.framework</em> text in the path.<div class="node"><p><hr>Node: <a name="How%20to%20install%20R">How to install R</a>,Next: <a rel="next" accesskey="n" href="#How%20to%20build%20and%20install%20the%20Aqua%20GUI">How to build and install the Aqua GUI</a>,Previous: <a rel="previous" accesskey="p" href="#How%20to%20configure%20and%20build%20R">How to configure and build R</a>,Up: <a rel="up" accesskey="u" href="#Building%20R%20from%20sources">Building R from sources</a><br></div><h3 class="section">How to install R</h3><p>A standard installation of R requires you have built it as a Framework. At this point just type (a rootpassword will be required):<pre class="example"> sudo make install</pre>and all will be installed in <em>/Library/Frameworks</em>.You can decide to change the R.framework destination by using the <em>prefix</em> option specifying thefinal destination.<pre class="smallexample"> sudo make prefix=/where/you/want/R.framework/to/go install</pre>As in the above, you don't need to specify the name <em>R.framework</em> in the path.<div class="node"><p><hr>Node: <a name="How%20to%20build%20and%20install%20the%20Aqua%20GUI">How to build and install the Aqua GUI</a>,Previous: <a rel="previous" accesskey="p" href="#How%20to%20install%20R">How to install R</a>,Up: <a rel="up" accesskey="u" href="#Building%20R%20from%20sources">Building R from sources</a><br></div><h3 class="section">How to build and install the Aqua GUI</h3><p>At the moment, there is nothing special to do to build the Aqua GUI.You just need to install it using<pre class="example"> make install-aqua</pre>and it will install the <em>R.app</em> application in the <em>Applications</em> folder on your system.The install procedure fails if the <code>R.framework</code> has not been installed first.<div class="node"><p><hr>Node: <a name="Command%20line%20version%20of%20R">Command line version of R</a>,Next: <a rel="next" accesskey="n" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a>,Previous: <a rel="previous" accesskey="p" href="#Building%20R%20from%20sources">Building R from sources</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Command line version of R</h2><p>The command line version of <small>R</small> is nothing but a classic unix-like implementation of <small>R</small>. So generaldocumentation for <small>R</small> applies to this version as well.On each release (and patched-release) ready to use binaries are distributed through <small>CRAN</small>.These binaries come with a common installer used by R with Aqua GUI so please readthe related notes (see <a href="#How%20to%20get%20R%20with%20Aqua%20GUI">How to get R with Aqua GUI</a>).To use <small>R</small> you probably need to add a symbolic link on your System as the <small>R</small> binary islocated inside the framework.Suppose you have the <em>/usr/local/bin</em> directory on your System, than you should justtype in your Terminal (a root password is required)<pre class="smallexample"> sudo ln -s /Library/Frameworks/R.framework/Resources/R /usr/local/bin/R</pre>Assuming that you have <em>/usr/local/bin</em> in your <em>PATH</em> environment variable, you'll be able to launch R from any locationon your System just by typing <em>R</em>.In this way, when you install a new version of the <em>R.framework</em> this link will point to the latest R binary.<div class="node"><p><hr>Node: <a name="R%20with%20Aqua%20GUI">R with Aqua GUI</a>,Next: <a rel="next" accesskey="n" href="#How%20to%20install%20packages">How to install packages</a>,Previous: <a rel="previous" accesskey="p" href="#Command%20line%20version%20of%20R">Command line version of R</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">R with Aqua GUI</h2><ul class="menu"><li><a accesskey="1" href="#How%20to%20get%20R%20with%20Aqua%20GUI">How to get R with Aqua GUI</a>:<li><a accesskey="2" href="#How%20to%20install%20the%20Aqua%20GUI">How to install the Aqua GUI</a>:<li><a accesskey="3" href="#The%20R%20Console">The R Console</a>:<li><a accesskey="4" href="#The%20Menus">The Menus</a>:<li><a accesskey="5" href="#Preferences">Preferences</a>:<li><a accesskey="6" href="#The%20near%20future%20of%20the%20Aqua%20GUI">The near future of the Aqua GUI</a>:<li><a accesskey="7" href="#Aqua%20GUI%20Bugs">Aqua GUI Bugs</a>:</ul><div class="node"><p><hr>Node: <a name="How%20to%20get%20R%20with%20Aqua%20GUI">How to get R with Aqua GUI</a>,Next: <a rel="next" accesskey="n" href="#How%20to%20install%20the%20Aqua%20GUI">How to install the Aqua GUI</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">How to get R with Aqua GUI</h3><p>The <code>bin/macosx</code> directory of a <small>CRAN</small> site contains a standardApple installer package named <code>R.dmg.sit</code> compressed in AladdinStuffit format. Once downloaded, uncompressed and executed, theinstaller will install the current non-developer release of R. R isa native Mac OS X Darwin version of R with an Aqua GUI.Inside<code>bin/macosx/</code><var>x</var><code>.</code><var>y</var><code></code> there are prebuilt binary packages tobe used with R corresponding to the "<var>x</var>.<var>y</var>" release ofR. The installation of these packages is available through the"Package" menu of the Aqua GUI (see <a href="#Packages%20Menu">Packages Menu</a>).<div class="node"><p><hr>Node: <a name="How%20to%20install%20the%20Aqua%20GUI">How to install the Aqua GUI</a>,Next: <a rel="next" accesskey="n" href="#The%20R%20Console">The R Console</a>,Previous: <a rel="previous" accesskey="p" href="#How%20to%20get%20R%20with%20Aqua%20GUI">How to get R with Aqua GUI</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">How to install the Aqua GUI</h3><div class="node"><p><hr>Node: <a name="The%20R%20Console">The R Console</a>,Next: <a rel="next" accesskey="n" href="#The%20Menus">The Menus</a>,Previous: <a rel="previous" accesskey="p" href="#How%20to%20install%20the%20Aqua%20GUI">How to install the Aqua GUI</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">The R Console</h3><p>In this section you'll find general informations on the Aqua GUI. For specific <small>R</small> tasks thatcan be done via the Aqua GUI using menus you should read below (see <a href="#The%20Menus">The Menus</a>).<ul class="menu"><li><a accesskey="1" href="#The%20Input%20and%20the%20Output">The Input and the Output</a>:<li><a accesskey="2" href="#Copy%20and%20Paste">Copy and Paste</a>:<li><a accesskey="3" href="#The%20current%20and%20startup%20working%20directories">The current and startup working directories</a>:<li><a accesskey="4" href="#Resizing%20the%20R%20Console">Resizing the R Console</a>:<li><a accesskey="5" href="#Input%20and%20Output%20text%20colors">Input and Output text colors</a>:</ul><div class="node"><p><hr>Node: <a name="The%20Input%20and%20the%20Output">The Input and the Output</a>,Next: <a rel="next" accesskey="n" href="#Copy%20and%20Paste">Copy and Paste</a>,Up: <a rel="up" accesskey="u" href="#The%20R%20Console">The R Console</a><br></div><h3 class="subsection">The Input and the Output</h4><p>The current design of the R Console is to have separate frames for input (user) and output (R).The user is supposed to type command into the bottom frame of the R Console, this input is echoedinto the upper frame and R will give any related output in the upper frame.The output frame (the upper one) is a read-only frame.<div class="node"><p><hr>Node: <a name="Copy%20and%20Paste">Copy and Paste</a>,Next: <a rel="next" accesskey="n" href="#The%20current%20and%20startup%20working%20directories">The current and startup working directories</a>,Previous: <a rel="previous" accesskey="p" href="#The%20Input%20and%20the%20Output">The Input and the Output</a>,Up: <a rel="up" accesskey="u" href="#The%20R%20Console">The R Console</a><br></div><h3 class="subsection">Copy and Paste</h4><p>Copy and paste works in R as in any other Macintosh application.But when two selection are active: one in the output frame and one in the input frame, the output frame takes precedencewhen copying to the clipboard.You can also copy from the <em>quartz()</em> graphic device (see <a href="#Quartz%20device">Quartz device</a>) to the clipboard. In this case a bitmap image iscreated. If you want high resolution graphic exports, you should better save the image using the <em>File/Save as</em> menu item (see <a href="#Quartz%20device">Quartz device</a>).<div class="node"><p><hr>Node: <a name="The%20current%20and%20startup%20working%20directories">The current and startup working directories</a>,Next: <a rel="next" accesskey="n" href="#Resizing%20the%20R%20Console">Resizing the R Console</a>,Previous: <a rel="previous" accesskey="p" href="#Copy%20and%20Paste">Copy and Paste</a>,Up: <a rel="up" accesskey="u" href="#The%20R%20Console">The R Console</a><br></div><h3 class="subsection">The current and startup working directories</h4><p>If not otherwise specified in the Preferences (see <a href="#Preferences">Preferences</a>), or if the specified path is no longer available, thenthe default working directory at startup is the user home.The working directory can be changed using the <em>setwd</em> R command or using the <em>Tools</em> menu item <em>Change working directory</em>.The current working directory is displayed on the main bar of the R Console window.<p>This feature is useful if you want different startup procedures defined by the <code>.Rprofile</code>; you canedit a <code>.Rprofile</code> (containing you personal initialization <small>R</small> commands) in a particular directory and usethe Preferences to change the startup directory. Next time you launch <code>R.app</code> the <code>.Rprofile</code> is read and executedby <small>R</small> at startup. This is the equivalent on Unix (or the command line) to launch <small>R</small> from different directories.<div class="node"><p><hr>Node: <a name="Resizing%20the%20R%20Console">Resizing the R Console</a>,Next: <a rel="next" accesskey="n" href="#Input%20and%20Output%20text%20colors">Input and Output text colors</a>,Previous: <a rel="previous" accesskey="p" href="#The%20current%20and%20startup%20working%20directories">The current and startup working directories</a>,Up: <a rel="up" accesskey="u" href="#The%20R%20Console">The R Console</a><br></div><h3 class="subsection">Resizing the R Console</h4><p>When the R Console Window is resized, the R option <em>width</em> is set appropriately so that any futureoutput will fit the window size. This behavior can be inhibited using the Preferences settings (see <a href="#Preferences">Preferences</a>).On closing the R application, the position and the size of the R Console window are saved in the Preferences and reusednext time you launch R. You can inhibit R to do this using the appropriate Preferences settings.<div class="node"><p><hr>Node: <a name="Input%20and%20Output%20text%20colors">Input and Output text colors</a>,Previous: <a rel="previous" accesskey="p" href="#Resizing%20the%20R%20Console">Resizing the R Console</a>,Up: <a rel="up" accesskey="u" href="#The%20R%20Console">The R Console</a><br></div><h3 class="subsection">Input and Output text colors</h4><p>Text windows and frames are divided in Read-Only and Read and Write ones. Text colors can be set separatelyfor the two kinds of windows. This happens as well for their respective backgrounds. Use the Preferences window to set thesecolors (see <a href="#Preferences">Preferences</a>).<div class="node"><p><hr>Node: <a name="The%20Menus">The Menus</a>,Next: <a rel="next" accesskey="n" href="#Preferences">Preferences</a>,Previous: <a rel="previous" accesskey="p" href="#The%20R%20Console">The R Console</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">The Menus</h3><ul class="menu"><li><a accesskey="1" href="#Application%20Menu">Application Menu</a>:<li><a accesskey="2" href="#File%20Menu">File Menu</a>:<li><a accesskey="3" href="#Edit%20Menu">Edit Menu</a>:<li><a accesskey="4" href="#Tools%20Menu">Tools Menu</a>:<li><a accesskey="5" href="#Workspace%20Menu">Workspace Menu</a>:<li><a accesskey="6" href="#Packages%20Menu">Packages Menu</a>:<li><a accesskey="7" href="#The%20Help%20Menu">The Help Menu</a>:</ul><div class="node"><p><hr>Node: <a name="Application%20Menu">Application Menu</a>,Next: <a rel="next" accesskey="n" href="#File%20Menu">File Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">Application Menu</h4><p>The Application menu is the first one after the main Apple Menu. In Mac OS X 10.3 it reports the name R.bin under Mac OS X 10.2 it is just R (as it should be).We are not able to fix this behavior at the moment.<p>With this menu you can access three items: 1. the About box, which tells you which version of R is currently in use, 2. Check for updates, which search on <small>CRAN</small> if a new versionof the binary distribution of <small>R</small> for Mac OS X is available (you need an internet connection), 3. you can access the Preferences (see <a href="#Preferences">Preferences</a>).<div class="node"><p><hr>Node: <a name="File%20Menu">File Menu</a>,Next: <a rel="next" accesskey="n" href="#Edit%20Menu">Edit Menu</a>,Previous: <a rel="previous" accesskey="p" href="#Application%20Menu">Application Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">File Menu</h4><p>This menu provides standard functionalities.The <em>open</em> command is associated to the action <em>Source </em><small>R</small><em> code</em>, which means that you can select a file, which is a script, and it will be executedin <small>R</small>. This is a interface to the <small>R</small> source command <code>source</code>.<div class="node"><p><hr>Node: <a name="Edit%20Menu">Edit Menu</a>,Next: <a rel="next" accesskey="n" href="#Tools%20Menu">Tools Menu</a>,Previous: <a rel="previous" accesskey="p" href="#File%20Menu">File Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">Tools Menu</h4><p>Apart for standard functionalities, the only relevant item in this menu is the <em>Edito Object</em> which is an interface tothe <small>R</small> <code>edit</code> function.<div class="node"><p><hr>Node: <a name="Tools%20Menu">Tools Menu</a>,Next: <a rel="next" accesskey="n" href="#Workspace%20Menu">Workspace Menu</a>,Previous: <a rel="previous" accesskey="p" href="#Edit%20Menu">Edit Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">Tools Menu</h4><p>With this menu you can load and save the history of commands typed in the <small>R</small> Console or view what's currently inside.You can also change the current working directory, let <small>R</small> show you the current working directory or set it back to thestartup directory. From release 1.9.0 of <small>R</small> the current working directory is also shown on the main window bar.<div class="node"><p><hr>Node: <a name="Workspace%20Menu">Workspace Menu</a>,Next: <a rel="next" accesskey="n" href="#Packages%20Menu">Packages Menu</a>,Previous: <a rel="previous" accesskey="p" href="#Tools%20Menu">Tools Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">Workspace Menu</h4><p>Here you find self explanatory menu items for manage your workspace in <small>R</small>. You can either load and save the workspace alsoby specifying file name. All of these are interfaces to the <code>load</code> and <code>save</code> <small>R</small> commands.The only relevant item, which is specific to this GUI, is the <em>Browse workspace</em>. This will open a window with a summarydescription of the objects in your workspace. Complex objects (like lists, data.frame etc) can be expanded (one level only though).<div class="node"><p><hr>Node: <a name="Packages%20Menu">Packages Menu</a>,Next: <a rel="next" accesskey="n" href="#The%20Help%20Menu">The Help Menu</a>,Previous: <a rel="previous" accesskey="p" href="#Workspace%20Menu">Workspace Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">Packages Menu</h4><p>Using this menu you can have access to the list of packages and data-sets installed on your system and to the oneson <small>CRAN</small> or on the Bioconductor site.<p>With the first two menus you can load and detach packages and data-set from the workspace.Let's start with the <em>Package Manager</em>. This opens a window with several columns displayed.For each package on your system you can see a check box, the current status of the package (loaded/not loaded), its nameand the package description text. You use the check box to select/de-select the packages you want.On window closure, the checked packaged will be loaded and the unchecked ones (if loaded) will the detached (not completely as on Mac OS X you cannotunload completely dynamic libraries).<p>The same applies to the <em>Dataset Manager</em> menu but for data-sets.<p>You can than get or update packages <small>CRAN</small> either in binary or source format. Daily build of <small>CRAN</small> packages are availablefor Mac OS X. If you don't know how to build <small>R</small> itself from source (see <a href="#Building%20R%20from%20sources">Building R from sources</a>),you'll probably be unable to build packages from source on your own.In this case, you should always choose for the binary option. These binary packages work (for sure!) for the release version of <small>R</small> for Mac OS Xyou find on <small>CRAN</small> even though it is not excluded that they will work for other prebuilt versions of <small>R</small>.<p>When you attempt to install packages from <small>CRAN</small>, <small>R</small> first tries to get a connection to the Internet to downloadthe list of available packages. Than a window will open similar to the one in the package manager with the only difference thatfor each package there is also the information concerning the version of the package installed on your system (if any) andthe version of the prebuilt package available on <small>CRAN</small>. When you close the window, the select packages will be downloaded.<p>The same strategy applies to the Bioconductor menu item, with some more options typical of the Bioconductor wayof managing packages.<p>For some reason it could happen that you have the package you want to install (either in binary or source form) on one of yourlocal disks, or even a directory containing a package source. You can use the last menu to do the task of installing the package.Having a package in a directory form usually applies to people that are developing packages themselves.<p>For more information on this topic see also <a href="#How%20to%20install%20packages">How to install packages</a>.<div class="node"><p><hr>Node: <a name="The%20Help%20Menu">The Help Menu</a>,Previous: <a rel="previous" accesskey="p" href="#Packages%20Menu">Packages Menu</a>,Up: <a rel="up" accesskey="u" href="#The%20Menus">The Menus</a><br></div><h3 class="subsection">The Help Menu</h4><p>Using this menu you can open the on-line manuals (<em>R Help</em>), read this FAQ and review the latest changes, bug fixes and new features of R for Mac OS X (<em>What's new in this version</em>).There are also interfaces to the R <em>help</em> and <em>help.search</em> functions as well as the <em>example</em> function.<div class="node"><p><hr>Node: <a name="Preferences">Preferences</a>,Next: <a rel="next" accesskey="n" href="#The%20near%20future%20of%20the%20Aqua%20GUI">The near future of the Aqua GUI</a>,Previous: <a rel="previous" accesskey="p" href="#The%20Menus">The Menus</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">Preferences</h3><p>You can set several aspects of the <small>R</small> GUI via preferences. You can access the Preferences window via the Application menu when the<small>R</small> Console is open.Preferences are organized in Tabs, more or less grouped for content.<ul class="menu"><li><a accesskey="1" href="#Text%20Windows%20tab">Text Windows tab</a>:<li><a accesskey="2" href="#Quartz%20device%20tab">Quartz device tab</a>:<li><a accesskey="3" href="#Packages%20tab">Packages tab</a>:<li><a accesskey="4" href="#Misc%20tab">Misc tab</a>:</ul><div class="node"><p><hr>Node: <a name="Text%20Windows%20tab">Text Windows tab</a>,Next: <a rel="next" accesskey="n" href="#Quartz%20device%20tab">Quartz device tab</a>,Up: <a rel="up" accesskey="u" href="#Preferences">Preferences</a><br></div><h3 class="subsection">Text Windows tab</h4><p>You can change the font size, face and the tab size in all the windows including the Console.If you have help windows opened, the changed only apply to the Console window and to the windowyou'll open from now on. This is a misfeature more than a bug.<p>You can also change the foreground and background colors for the read-only windows (i.e. the <small>R</small> Consoleoutput and the Help windows) and for read-and-write windows (i.e. the <small>R</small> Console input and the Edit windows).At the moment you cannot change the color of the cursor which always stays black which ever background you choose.So, for the time being, it's a bad idea to set the background of the <small>R</small> Console to black.<p>You have also the possibility to check two options. The first is for adapting the <small>R</small> output when you resize the<small>R</small> Console to the maximum character displayable, the second one is to let <small>R</small> remember the position of the<small>R</small> Console on exit.<div class="node"><p><hr>Node: <a name="Quartz%20device%20tab">Quartz device tab</a>,Next: <a rel="next" accesskey="n" href="#Packages%20tab">Packages tab</a>,Previous: <a rel="previous" accesskey="p" href="#Text%20Windows%20tab">Text Windows tab</a>,Up: <a rel="up" accesskey="u" href="#Preferences">Preferences</a><br></div><h3 class="subsection">Quartz device tab</h4><p>You can set all the parameters of the <code>quartz</code> device for this tab. Please note: your changes only take effectif you select the final checkbox, namely <em>override the R quartz default settings</em>.<p>This also apply to the <em>Quartz window position</em> option even if it is not a <code>quartz</code> parameter itself.<div class="node"><p><hr>Node: <a name="Packages%20tab">Packages tab</a>,Next: <a rel="next" accesskey="n" href="#Misc%20tab">Misc tab</a>,Previous: <a rel="previous" accesskey="p" href="#Quartz%20device%20tab">Quartz device tab</a>,Up: <a rel="up" accesskey="u" href="#Preferences">Preferences</a><br></div><h3 class="subsection">Packages tab</h4><p>From this tab you can set the default repositories for the <small>CRAN</small> and Bioconductor urls. This will affect thecorresponding <small>R</small> <code>options</code>.<div class="node"><p><hr>Node: <a name="Misc%20tab">Misc tab</a>,Previous: <a rel="previous" accesskey="p" href="#Packages%20tab">Packages tab</a>,Up: <a rel="up" accesskey="u" href="#Preferences">Preferences</a><br></div><h3 class="subsection">Misc tab</h4><p>For this tab you can decide to redirect the stderr and stdout of <small>R</small> and the tasks launched by <small>R</small>, to the <small>R</small> Console.This is useful, for example, during package installation. If you don't check these options, every output will be sent to the <em>Console</em>application which you can find on every Mac OS X installation inside the directory <code>/Applications/Utilities</code>.<p>You can also set the startup working directory. This is very useful for having different sessions in differentdirectories (see <a href="#The%20current%20and%20startup%20working%20directories">The current and startup working directories</a> and <a href="#How%20can%20I%20have%20a%20per%20session%20.Rprofile%3f">How can I have a per session .Rprofile?</a>).<div class="node"><p><hr>Node: <a name="The%20near%20future%20of%20the%20Aqua%20GUI">The near future of the Aqua GUI</a>,Next: <a rel="next" accesskey="n" href="#Aqua%20GUI%20Bugs">Aqua GUI Bugs</a>,Previous: <a rel="previous" accesskey="p" href="#Preferences">Preferences</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">The near future of the Aqua GUI</h3><p>Jointly with Simon Urbanek we are currently working to replace the current Aqua GUI, which is Carbon-based,with a pure Cocoa GUI. This will allow for a better integration of R with Mac OS X anda fully Aqua-compliant GUI.A preview of the Cocoa GUI for Darwin R can be obtained after the officialrelease of R 1.9.0 is out from <a href="http://www.economia.unimi.it/R">http://www.economia.unimi.it/R</a>.<div class="node"><p><hr>Node: <a name="Aqua%20GUI%20Bugs">Aqua GUI Bugs</a>,Previous: <a rel="previous" accesskey="p" href="#The%20near%20future%20of%20the%20Aqua%20GUI">The near future of the Aqua GUI</a>,Up: <a rel="up" accesskey="u" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a><br></div><h3 class="section">Aqua GUI Bugs</h3><p>On Unix systems a bug report can be generated using the function<code>bug.report()</code>. This automatically includes the versioninformation and sends the bug to the correct address. Alternatively thebug report can be emailed to <a href="mailto:R-bugs@R-project.org">R-bugs@R-project.org</a> or submittedto the Web page at <a href="http://bugs.R-project.org/">http://bugs.R-project.org/</a>.<p>You can also send specific Aqua GUI bugs directly to <a href="mailto:stefano.iacus@unimi.it">stefano.iacus@unimi.it</a><p>In any circumstances, in case of a crash, please report thecrash.log for the <em>R.bin</em> application. You can get thiscrash.log using the <em>Console.app</em> located inside <em>/Applications/Utilities</em>.<div class="node"><p><hr>Node: <a name="How%20to%20install%20packages">How to install packages</a>,Next: <a rel="next" accesskey="n" href="#R%20and%20external%20applications">R and external applications</a>,Previous: <a rel="previous" accesskey="p" href="#R%20with%20Aqua%20GUI">R with Aqua GUI</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">How to install packages</h2><p>You have several options for installing new packages on your system. We discuss here only the interface to the standard<small>R</small> functions like <code>install.package</code>. For the <small>R</small> functions see the standard <small>R</small> documentation.<ul class="menu"><li><a accesskey="1" href="#Which%20kind%20of%20packages%20can%20I%20install%20using%20the%20GUI%3f">Which kind of packages can I install using the GUI?</a>:<li><a accesskey="2" href="#Installation%20of%20packages%20from%20source">Installation of packages from source</a>:<li><a accesskey="3" href="#Installation%20of%20pre-built%20binary%20packages">Installation of pre-built binary packages</a>:<li><a accesskey="4" href="#Can%20I%20install%20packages%20built%20for%20other%20platforms%3f">Can I install packages built for other platforms?</a>:<li><a accesskey="5" href="#Where%20are%20the%20packages%20I've%20installed%3f">Where are the packages I've installed?</a>:</ul><div class="node"><p><hr>Node: <a name="Which%20kind%20of%20packages%20can%20I%20install%20using%20the%20GUI%3f">Which kind of packages can I install using the GUI?</a>,Next: <a rel="next" accesskey="n" href="#Installation%20of%20packages%20from%20source">Installation of packages from source</a>,Up: <a rel="up" accesskey="u" href="#How%20to%20install%20packages">How to install packages</a><br></div><h3 class="section">Which kind of packages can I install using the GUI?</h3><p>At the moment the GUI menus only provide direct access/download/installation of packages located on <small>CRAN</small> or in theBioconductor repository. You can also install packages from local files, either binary of source packages, as explainedbelow. Otherwise you can use the appropriate <small>R</small> commands to install packages from a specific location other than the above mentioned ones.<div class="node"><p><hr>Node: <a name="Installation%20of%20packages%20from%20source">Installation of packages from source</a>,Next: <a rel="next" accesskey="n" href="#Installation%20of%20pre-built%20binary%20packages">Installation of pre-built binary packages</a>,Previous: <a rel="previous" accesskey="p" href="#Which%20kind%20of%20packages%20can%20I%20install%20using%20the%20GUI%3f">Which kind of packages can I install using the GUI?</a>,Up: <a rel="up" accesskey="u" href="#How%20to%20install%20packages">How to install packages</a><br></div><h3 class="section">Installation of packages from source</h3><p>You can choose to install packages from source if they are located on <small>CRAN</small>, on the BioConductor repository andon your local disk. In any case, in order to be able to build packages from source, you need to have the same workingsetup for building <small>R</small> itself (see <a href="#Building%20R%20from%20sources">Building R from sources</a>). In same cases you can still build packages without allthe tools installed, but surely not for all the packages containing C/C++ or Fortran source code.<p>If you decide to install packages from <small>CRAN</small> you should use the <em>Packages</em> menu of the GUI. In particular the sub-item <em>Get CRAN packages.../Source</em>.This will connect to <small>CRAN</small> through the Internet and a list of available packages will be shown.This is list tells you if a package is already installed on your system, the version of the package available on <small>CRAN</small> and the versionof the same package if already installed.You can make multiple selection of packages you intend to install using the checkboxes (one per package).When you close this window, you'll be asked if you really want to download the selected packages and the process of installationbegins. If you don't select any package, nothing happens.<small>R</small> will not respond on the Console until you close this window.The same applies for packages in the BioConductor repository. You have also several other options specific to theBioConductor way of managing repositories of packages.<p>You can also download any other package from the Internet yourself and decide to install it from source.You have to use <em>Packages/->Install form local file</em> submenus. Where you can choose a standard <code>package.tar.gz</code>tarball or the directory containing your package if you have the package in expanded form.<div class="node"><p><hr>Node: <a name="Installation%20of%20pre-built%20binary%20packages">Installation of pre-built binary packages</a>,Next: <a rel="next" accesskey="n" href="#Can%20I%20install%20packages%20built%20for%20other%20platforms%3f">Can I install packages built for other platforms?</a>,Previous: <a rel="previous" accesskey="p" href="#Installation%20of%20packages%20from%20source">Installation of packages from source</a>,Up: <a rel="up" accesskey="u" href="#How%20to%20install%20packages">How to install packages</a><br></div><h3 class="section">Installation of pre-built binary packages</h3><p>Same considerations of above apply with two minor differences. The first one is that se only distribute pre-builtversion of packages which pass all the test/checks on Mac OS X. So you'll see that some of the packages are missing with respect to the huge listof source packages available on <small>CRAN</small>.<p>The second difference is that, when you install packages from local file, it is assumed that the binary package is namedas <code>package.tgz</code>. This is to distinguish among source and binary archives.<div class="node"><p><hr>Node: <a name="Can%20I%20install%20packages%20built%20for%20other%20platforms%3f">Can I install packages built for other platforms?</a>,Next: <a rel="next" accesskey="n" href="#Where%20are%20the%20packages%20I've%20installed%3f">Where are the packages I've installed?</a>,Previous: <a rel="previous" accesskey="p" href="#Installation%20of%20pre-built%20binary%20packages">Installation of pre-built binary packages</a>,Up: <a rel="up" accesskey="u" href="#How%20to%20install%20packages">How to install packages</a><br></div><h3 class="section">Can I install packages built for other platforms?</h3><p>As a general rule the answer is <em>yes</em> if the package does not contain any C/C++/Fortran code in the sources, otherwisethe answer is negative. Another caution should be taken, that is, the package and the installed version of <small>R</small> should bethe same major release, i.e. you can install a package built for <small>R</small> 1.8.0 on <small>R</small> 1.8.1, but usually not the samepackage on <small>R</small> 1.9.0.<p>A Mac OS X specific requirements, is that a prebuilt package is assumed to be named (and accordingly archived andcompressed) as <code>package_name.tgz</code>.On Windows, for example, packages come in a zipped format.<div class="node"><p><hr>Node: <a name="Where%20are%20the%20packages%20I've%20installed%3f">Where are the packages I've installed?</a>,Previous: <a rel="previous" accesskey="p" href="#Can%20I%20install%20packages%20built%20for%20other%20platforms%3f">Can I install packages built for other platforms?</a>,Up: <a rel="up" accesskey="u" href="#How%20to%20install%20packages">How to install packages</a><br></div><h3 class="section">Where are the packages I've installed?</h3><p>The main library of packages is the one located inside the R.framework. This library contains the packages (base andrecommended ones) distributed along with <small>R</small>. At the moment you cannot use the GUI Console to install packagesin this location because of authentication problems, you can surely do this from the command line with an adminpassword, with something like<pre class="example"> sudo R CMD INSTALL pkg_ver.tar.gz</pre><p>By default, the user of <code>R.app</code> installs packages inside the <code>Library/R/library</code> directoryin his home directory, i.e. <code>~/Library/R/library</code>.If you install a package using the <code>R.app</code> interfaces and you then use <small>R</small> from the command line,you won't see or have access to these packages unless you add the <code>~/Library/R/library</code> to thelist of libraries locations. You can do the following from inside <small>R</small><pre class="example"> .libPaths("~/Library/R/library")</pre>or write this command in the <code>.Rprofile</code> file in your startup directory.On some version of OS X the <code>~</code> symbol is not correctly expanded. You should preferably use thisversion of the above command<pre class="example"> .libPaths(path.expand("~/Library/R/library"))</pre><p>If you have a version of <code>RAqua.app</code> installed on your system, it is likely that you have all thepackages installed in <code>~/Library/RAqua/library</code>. You can add this library of packages in the <code>.libPaths()</code>but most of them will probably not work as they were built for release 1.8.x of <small>R</small>.<div class="node"><p><hr>Node: <a name="R%20and%20external%20applications">R and external applications</a>,Next: <a rel="next" accesskey="n" href="#Quartz%20device">Quartz device</a>,Previous: <a rel="previous" accesskey="p" href="#How%20to%20install%20packages">How to install packages</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">R and external applications</h2><ul class="menu"><li><a accesskey="1" href="#AppleScript%20support">AppleScript support</a>:<li><a accesskey="2" href="#External%20editors">External editors</a>:<li><a accesskey="3" href="#Finder%20actions">Finder actions</a>:</ul><div class="node"><p><hr>Node: <a name="AppleScript%20support">AppleScript support</a>,Next: <a rel="next" accesskey="n" href="#External%20editors">External editors</a>,Up: <a rel="up" accesskey="u" href="#R%20and%20external%20applications">R and external applications</a><br></div><h3 class="section">AppleScript support</h3><p><small>R</small> has partial support for Apple-Scripts.At the moment R can be invoked and asked to run commands from an AppleScript script.What follows is an example of script that interacts with <small>R</small>. It firstly invokes <small>R</small> and thensends commands to <small>R</small> with the <code>cmd</code> applescript command.<pre class="example"> set CommandLine to "R.Version()"trytell application "R"activatewith timeout of 90000 secondscmd CommandLinecmd "Sys.getenv()"cmd "print(\"HelloWorld!\")"end timeoutend tellend try</pre><p>In the above, <code>cmd</code> is the (only) applescript command in the <small>R</small> dictionary that isused to tell <small>R</small> to execute an <small>R</small> command in the R Console. The syntax is<pre class="example"> cmd <command string></pre>where command string have to be in quotes. Actually, the output of the commandis not sent back to the application that is calling <small>R</small> but to the <small>R</small> Console directly.<p>There are some issues. The first is that if <small>R</small> is still not running, it will take a while (depending onhow fast your machine is) to startup. In the meanwhile the script sends commands without waiting and itcould happen that some commands are missed by <small>R</small>, i.e. they arrive before <small>R</small> is ready toreceive applescript commands. The second issue, is that it could be that the applescript calls a bad versionof <small>R</small>. This could happen if you have an old version of <small>R</small> (for example the old Carbon <small>R</small>) installed on yourSystem.<p>As an example, we report here a small script that asks <small>R</small> to <code>source</code> a file using a file dialog.<pre class="smallexample"> set file_to_source to (choose file with prompt "Choose file to source") as aliastrytell application "R"activatewith timeout of 90000 secondscmd "source(\"" & file_to_source & "\")"end timeoutend tellend try</pre><div class="node"><p><hr>Node: <a name="External%20editors">External editors</a>,Next: <a rel="next" accesskey="n" href="#Finder%20actions">Finder actions</a>,Previous: <a rel="previous" accesskey="p" href="#AppleScript%20support">AppleScript support</a>,Up: <a rel="up" accesskey="u" href="#R%20and%20external%20applications">R and external applications</a><br></div><h3 class="section">External editors</h3><p><small>R</small> accepts the Apple Event command <em>open</em>. This means than an external editor can communicate with <small>R</small> sendingportions of <small>R</small> code to execute via files. This is the approach used by the <small>R</small>-Tcl Mode in Alpha X(see <a href="http://www.kelehers.org/alpha/">http://www.kelehers.org/alpha/</a>).<div class="node"><p><hr>Node: <a name="Finder%20actions">Finder actions</a>,Previous: <a rel="previous" accesskey="p" href="#External%20editors">External editors</a>,Up: <a rel="up" accesskey="u" href="#R%20and%20external%20applications">R and external applications</a><br></div><h3 class="section">Finder actions</h3><p>Dragging a file on the <small>R</small> icon, causes <small>R</small> to source this file via the <code>source</code> <small>R</small> command or,if the file is an <small>R</small> image data file RDX1 or RDX2 (normally files with extension <code>.rda</code> or <code>.Rdata</code>), the data is loaded in the workspace and every objectwith the same name in the workspace is overwritten without notice. Loading a data file is equivalent tothe <small>R</small> command <code>load</code>.At the moment there is no control over the file types, i.e. dragging wrong files (i.e. files that arenot <small>R</small> scripts or image data) simply gives an error. It's up to the user to <em>do the right thing</em>.<p>If <small>R</small> is not yet running this action causes <small>R</small> to startup.<div class="node"><p><hr>Node: <a name="Quartz%20device">Quartz device</a>,Next: <a rel="next" accesskey="n" href="#TclTk%20issues">TclTk issues</a>,Previous: <a rel="previous" accesskey="p" href="#R%20and%20external%20applications">R and external applications</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Quartz device</h2><p>The quartz device is the native graphic device in R for Mac OS X. It's name derives from Apple's Quartz Technologywhich is essentially similar to PDF rendering. One of the most amazing features of Quartz is antialiasing which gives you<em>very nice</em> plots and images. Try to compare a quartz plot with the same plot generated onany other interactive device. For its PDF nature it is also resolution independent.<ul class="menu"><li><a accesskey="1" href="#Interactive%20mode">Interactive mode</a>:<li><a accesskey="2" href="#Saving%20the%20image">Saving the image</a>:<li><a accesskey="3" href="#Copying%20the%20image%20into%20the%20clipboard">Copying the image into the clipboard</a>:<li><a accesskey="4" href="#Known%20bugs%20and%20missing%20features">Known bugs and missing features</a>:</ul><div class="node"><p><hr>Node: <a name="Interactive%20mode">Interactive mode</a>,Next: <a rel="next" accesskey="n" href="#Saving%20the%20image">Saving the image</a>,Up: <a rel="up" accesskey="u" href="#Quartz%20device">Quartz device</a><br></div><h3 class="section">Interactive mode</h3><p>The quartz device allows for interaction. You can use both <code>identify</code> and <code>locator</code> functions.To break the sequence you should press the ESC key on your keyboard as Apple's mouse have ever had only onebutton.<div class="node"><p><hr>Node: <a name="Saving%20the%20image">Saving the image</a>,Next: <a rel="next" accesskey="n" href="#Copying%20the%20image%20into%20the%20clipboard">Copying the image into the clipboard</a>,Previous: <a rel="previous" accesskey="p" href="#Interactive%20mode">Interactive mode</a>,Up: <a rel="up" accesskey="u" href="#Quartz%20device">Quartz device</a><br></div><h3 class="section">Saving the image</h3><p>You can can the content of the quartz device window into a PDF file. This is a very simple way toexport high quality graphics from <small>R</small> into other applications on Mac OS X graphics is PDF based (so are almost allapplications available). If you want bitmap copies of you quartz device window just use copy, to copy the image into the clipboard andpaste the result in a graphic application (see <a href="#Copying%20the%20image%20into%20the%20clipboard">Copying the image into the clipboard</a>).<div class="node"><p><hr>Node: <a name="Copying%20the%20image%20into%20the%20clipboard">Copying the image into the clipboard</a>,Next: <a rel="next" accesskey="n" href="#Known%20bugs%20and%20missing%20features">Known bugs and missing features</a>,Previous: <a rel="previous" accesskey="p" href="#Saving%20the%20image">Saving the image</a>,Up: <a rel="up" accesskey="u" href="#Quartz%20device">Quartz device</a><br></div><h3 class="section">Copying the image into the clipboard</h3><p>You can copy the content of the quartz device window in the clipboard to make the resulting image available forpasting into other applications. The clipboard will contain a bitmap copy of the quartz device window. If youwant to work with high resolution images, you should save the content of the quartz device as a PDF file (see <a href="#Saving%20the%20image">Saving the image</a>).Pay attention to the following fact: the bitmap image produced has exactly the same dimensions of the quartz device window. Thismeans that if you resize the window, the resulting image you obtain in the clipboard will have the samedimensions and you cannot resize the image from the inside another applications (say MS-Word) without loosing quality.<div class="node"><p><hr>Node: <a name="Known%20bugs%20and%20missing%20features">Known bugs and missing features</a>,Previous: <a rel="previous" accesskey="p" href="#Copying%20the%20image%20into%20the%20clipboard">Copying the image into the clipboard</a>,Up: <a rel="up" accesskey="u" href="#Quartz%20device">Quartz device</a><br></div><h3 class="section">Known bugs and missing features</h3><p>When rendering text and/or mathematical symbols the style is ignored, i.e. only plain style is drawn.The printing function is not yet implemented.<div class="node"><p><hr>Node: <a name="TclTk%20issues">TclTk issues</a>,Next: <a rel="next" accesskey="n" href="#Additional%20resources">Additional resources</a>,Previous: <a rel="previous" accesskey="p" href="#Quartz%20device">Quartz device</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">TclTk issues</h2><p>Each binary distribution of <small>R</small> available through <small>CRAN</small> is built to use the X11 implementation of TclTk.Of course a X windows server has to be started first. If you are not using the Aqua GUI you need to alsodefine the environment variable DISPLAY before attempting to use X11 from inside <small>R</small>. You can do this as follows<pre class="example"> Sys.putenv("DISPLAY"=":0")</pre>If you don't like the X11 GUI you would probably want to build R using the Aqua version of TclTk (see <a href="#the%20Aqua%20TclTk%20headers%20and%20libraries%20(optional)">the Aqua TclTk headers and libraries (optional)</a>).After installing the R.framework you should do the following to have the quartz device working under Aqua TclTk. Open aTerminal window and move inside the <code>Resources/bin</code> directory of the <code>R.framework</code>(usually <code>/Library/Frameworks/R.framework</code>), then type the following<pre class="example"> sudo /Developer/Tools/Rez -t APPL Carbon.r -o R.bin</pre><div class="node"><p><hr>Node: <a name="Additional%20resources">Additional resources</a>,Next: <a rel="next" accesskey="n" href="#Acknowledgments">Acknowledgments</a>,Previous: <a rel="previous" accesskey="p" href="#TclTk%20issues">TclTk issues</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Additional resources</h2><p>Here are few references that can be of interest for Mac OS X and/or developers.<ul class="menu"><li><a accesskey="1" href="#Apple%20Developer%20Connection">Apple Developer Connection</a>:<li><a accesskey="2" href="#The%20R%20for%20Mac%20OS%20X%20Developer%20page">The R for Mac OS X Developer page</a>:</ul><div class="node"><p><hr>Node: <a name="Apple%20Developer%20Connection">Apple Developer Connection</a>,Next: <a rel="next" accesskey="n" href="#The%20R%20for%20Mac%20OS%20X%20Developer%20page">The R for Mac OS X Developer page</a>,Up: <a rel="up" accesskey="u" href="#Additional%20resources">Additional resources</a><br></div><h3 class="section">Apple Developer Connection</h3><p>The Apple Developer Connection (can be reached at <a href="http://developer.apple.com">http://developer.apple.com</a>) is the main sourceof information for Apple products (OS, hardware, software) for developers. You can subscribe for free toADC and get the latest up-to-date tools from Apple (compilers for example).<div class="node"><p><hr>Node: <a name="The%20R%20for%20Mac%20OS%20X%20Developer%20page">The R for Mac OS X Developer page</a>,Previous: <a rel="previous" accesskey="p" href="#Apple%20Developer%20Connection">Apple Developer Connection</a>,Up: <a rel="up" accesskey="u" href="#Additional%20resources">Additional resources</a><br></div><h3 class="section">The R for Mac OS X Developer page</h3><p>There is a page dedicated to the latest R-devel version of R. This page is located at<a href="http://www.economia.unimi.it/R">http://www.economia.unimi.it/R</a> and is maintained by Stefano M. Iacus.This page is intended to give additional documentation for building the latest R-develversion of R. From time to time, snapshots of R-devel binaries are available for testing purposes.<div class="node"><p><hr>Node: <a name="Acknowledgments">Acknowledgments</a>,Next: <a rel="next" accesskey="n" href="#Sparse%20questions">Sparse questions</a>,Previous: <a rel="previous" accesskey="p" href="#Additional%20resources">Additional resources</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Acknowledgments</h2><p>Special thanks go to Simon Urbanek, Jan de Leeuw, Byron Ellis and Thomas Lumleyin random order. Last but not least Apple for amazing OS and GUI.<div class="node"><p><hr>Node: <a name="Sparse%20questions">Sparse questions</a>,Previous: <a rel="previous" accesskey="p" href="#Acknowledgments">Acknowledgments</a>,Up: <a rel="up" accesskey="u" href="#Top">Top</a><br></div><h2 class="chapter">Sparse questions</h2><ul class="menu"><li><a accesskey="1" href="#How%20can%20I%20have%20a%20per%20session%20.Rprofile%3f">How can I have a per session .Rprofile?</a>:<li><a accesskey="2" href="#What%20happens%20if%20I%20drag%20a%20file%20on%20the%20R%20icon%3f">What happens if I drag a file on the R icon?</a>:<li><a accesskey="3" href="#How%20can%20I%20interrupt%20lengthy%20operations%20or%20output%3f">How can I interrupt lengthy operations or output?</a>:<li><a accesskey="4" href="#I%20don't%20see%20a%20thing%20when%20installing%20packages!">I don't see a thing when installing packages!</a>:</ul><div class="node"><p><hr>Node: <a name="How%20can%20I%20have%20a%20per%20session%20.Rprofile%3f">How can I have a per session .Rprofile?</a>,Next: <a rel="next" accesskey="n" href="#What%20happens%20if%20I%20drag%20a%20file%20on%20the%20R%20icon%3f">What happens if I drag a file on the R icon?</a>,Up: <a rel="up" accesskey="u" href="#Sparse%20questions">Sparse questions</a><br></div><h3 class="section">How can I have a per session .Rprofile?</h3><p>You can by writing a <code>.Rprofile</code> file in your favoritesession directory and change accordingly the startup working directory using the Preferences (see <a href="#The%20current%20and%20startup%20working%20directories">The current and startup working directories</a>).<div class="node"><p><hr>Node: <a name="What%20happens%20if%20I%20drag%20a%20file%20on%20the%20R%20icon%3f">What happens if I drag a file on the R icon?</a>,Next: <a rel="next" accesskey="n" href="#How%20can%20I%20interrupt%20lengthy%20operations%20or%20output%3f">How can I interrupt lengthy operations or output?</a>,Previous: <a rel="previous" accesskey="p" href="#How%20can%20I%20have%20a%20per%20session%20.Rprofile%3f">How can I have a per session .Rprofile?</a>,Up: <a rel="up" accesskey="u" href="#Sparse%20questions">Sparse questions</a><br></div><h3 class="section">What happens if I drag a file on the R icon?</h3><p>In this case <small>R</small> will try to source this file or load the image data file (see <a href="#Finder%20actions">Finder actions</a>). If <small>R</small> is notyet running it will be launched.<div class="node"><p><hr>Node: <a name="How%20can%20I%20interrupt%20lengthy%20operations%20or%20output%3f">How can I interrupt lengthy operations or output?</a>,Next: <a rel="next" accesskey="n" href="#I%20don't%20see%20a%20thing%20when%20installing%20packages!">I don't see a thing when installing packages!</a>,Previous: <a rel="previous" accesskey="p" href="#What%20happens%20if%20I%20drag%20a%20file%20on%20the%20R%20icon%3f">What happens if I drag a file on the R icon?</a>,Up: <a rel="up" accesskey="u" href="#Sparse%20questions">Sparse questions</a><br></div><h3 class="section">How can I interrupt lengthy operations or output?</h3><p>You can now use the standard Macintosh control break sequence, that is you should press"Cmd option" and "." (dot). This will interrupt any <small>R</small> loops. The "Esc" key gives you the same result.<div class="node"><p><hr>Node: <a name="I%20don't%20see%20a%20thing%20when%20installing%20packages!">I don't see a thing when installing packages!</a>,Previous: <a rel="previous" accesskey="p" href="#How%20can%20I%20interrupt%20lengthy%20operations%20or%20output%3f">How can I interrupt lengthy operations or output?</a>,Up: <a rel="up" accesskey="u" href="#Sparse%20questions">Sparse questions</a><br></div><h3 class="section">I don't see a thing when installing packages!</h3><p>Well, this is not a question but the answer is that you are not looking at the right place.Every input and output which is not <small>R</small> specific (i.e. the output of standard commands) is generally sent tothe standard output (stdout) or standard error (stderr) depending on its nature. In particular every call to the<code>system</code> function, executes outside <small>R</small> in a Mac OS X shell. The package installation is done viathe <code>system</code> facility.You have to use the Preferences to redirect the stderr and/or the stdout to the <small>R</small> Console (see <a href="#Misc%20tab">Misc tab</a>)or you can look at the <em>Console</em> application inside <code>/Applications/Utilities</code> on your system.This applies to every GUI application on Mac OS X so, as a general rule, if an application behaves strangely or quits,please have a look to the <em>Console</em> application.</body></html>