R Commander For Mac

  



The Rcmdr package is a standard R package, and it installs andis loaded in the normal manner. There are, however, a few installation issues,particularly on Macintosh systems, and these are described in this document.

For more detailed basic installation instructions, see Ch. 2 of my book Using the R Commander.

R provides a powerful and comprehensive system for analysing data and when used in conjunction with the R-commander (a graphical user interface, commonly known as Rcmdr) it also provides one that is easy and intuitive to use. Basically, R provides the engine that carries out the analyses and Rcmdr provides a convenient way for users to input commands. Once you have installed R and have it running (see here), it is a simple matter to install the R-commander GUI. Although this can be achieved using the pull-down menus in some R-consoles, the following procedure demonstrates the installation using the command line, as this applies to all platforms. 1) On Mac, R Commander opens only if XQuartz is opened. So, the first step of using R Commander is to make sure that XQuartz is opened. More information on “Installing R Commander for Mac users”. 2) Some Mac users also report that it is impossible to switch between languages while R Commander is running. This means, that some users might. Installing R Commander on your Mac Installing R and X11, MacOS Users only 1. Make sure that your MacOS is up-to-date by running Software Update from the Apple menu in thetop-left. Under Mac OS X Mavericks and later, the R Commander may appear to freeze or hesitate when run under R.app if the R.app window is hidden and 'app nap' is turned on. It is recommended that app nap be turned off for R.app, which can be most conveniently done via the R Commander Tools menu.

A general point is keep in mind is that the Rcmdr package usesa number of other 'contributed' packages (in addition to packages,such as tcltk and MASS, that are part of the standard R distribution), and thesemust be present for it to work properly. Many of these packages have their own dependencies, which depend on still other packages, etc. These additional packages will either be installed along with the Rcmdr package or the Rcmdr will offer to install them when it first starts up (and you should accept the offer).

General Installation Procedure

The following instructions may be all you need to get started; for more detailed instructions and potential installation issues, see the various sections below. These instructions assume that you have an active Internet connection.

  1. Download R from CRAN and install it in the manner appropriate to your operating system. If you have an old version of R -- that is, older than the current version -- then it's generally a good idea to install the current version of R before installing the Rcmdr package. On Windows, opt for a customized startup and select the single-document interface ('SDI,' see the Windows notes below for details).
  2. On macOS only, download and install XQuartz, and reboot your computer (see the Mac notes below for greater detail).
  3. Start R, and at the > command prompt, type the command install.packages('Rcmdr')
  4. Once it is installed, to load the Rcmdr package, just enter thecommand library(Rcmdr)

General Installation Issues

Ocassionally, an R package or packages required by the Rcmdr package fails to be installed and the R Commander can't start. When this happens, there is typically an informative error message about the missing package(s). There are two common causes for this problem: (1) The package(s) in question may be temporarily missing from the CRAN mirror that you used; or (2) the package(s) may be permanently unavailable for an older version of R.

In the first instance, you can install (each) missing package directly via the command install.packages('package-name'), or, for more than one missing package, install.packages(c('package-1-name', 'package-2-name', etc)) , selecting a different CRAN mirror from the one you used initially. In the second instance, you can install the current version of R (always a good idea), and start again.

R commander mac installieren

If you wish to start the R Commander automatically when R starts up, you canadd a plain-text ('ascii') file named .Rprofile to your home directory, with the following contents:

local({
old <- getOption('defaultPackages')
options(defaultPackages = c(old, 'Rcmdr'))
})

To determine your home directory, type the command getwd() ('get working directory') at the > command prompt in a fresh R session. Be sure to use a plain-text editor to create this file, not a word processor like Word, or, if using a word processor, to save the file as a plain-text file.

Notes for specific platforms

If the general installation procedure and installation issues above are insufficient, here is specific information for Windows, Linux, and macOS systems:

R Commander For Mac

Windows Installation

The easiest way to install the Rcmdr package is via the Rgui Packages -> Install packagesmenu or via the command install.packages('Rcmdr') entered at the R > command prompt. R will ask you to select a CRAN mirror; pick the first, '0-Cloud' mirror, or a mirror site near you.

When you first load the Rcmdr package with the command library('Rcmdr'), it will offer to download and install missingdependencies; allow it to do so. If you installed R in Program Files, you may prefer to run R with adminstratorprivileges to install packages: Right click the R icon and select'Run as administrator.' Otherwise, packages will be installed in a package library particular to your user account rather than the main R package library; that should work OK too. I suggest that you install R into a differentdirectory, such as C:R, to avoid this issue.

On Windows, the Rcmdr package works best with the 'single-document 'R interface (SDI). Under the default 'multiple-document interface' (MDI), R Commander dialog boxes may not stay on top of the main R window. In the Startup options screen of the R installer, select Yes (customized startup). Then select the SDI (single-document interface) in preference to the default MDI (multiple-document interface); feel free to make other changes, but you may take all the remaining defaults.

If you install R with the standard MDI, to enable the SDI you can make a copy of the R desktop icon (right-click on the icon,drag it to a different location on the desktop, select Copy Here fromthe context menu). Right-click the new icon and select Properties. Add--sdi (preceded by a space) to the Targetfield on the Shortcut tab of the Properties dialog box. The fieldshould read something like'C:Program FilesRR-x.y.zbinRgui.exe'--sdi, where x.y.z specifies the version of R you installed. If you wish, change the name of the icon on the Generaltab (e.g., to R x.y.z SDI). Click OK. Alternatively, you canyou can edit the Rconsole file in R's etc subdirectory to select the SDI.

Linux/Unix Installation

Linux/Unix systems typically have all of the software requiredfor building packages already installed. The easiest way to install the Rcmdr package is to run R as root andissue the command install.packages('Rcmdr') at the R prompt. R will ask you to select a CRAN mirror; pick the first, '0-Cloud' mirror, or a mirror site near you.

On Ubutu systems, in particular, the following procedure should work (slightly modified from a suggestion by Ista Zahn):

  1. Add the R repository to Ubuntu (see http://cran.r-project.org/bin/linux/ubuntu/).
  2. Install base R and the R dev package: sudo apt-get installr-base r-base-dev
  3. Start R from the Ubuntu command line as root so you can installpackages system-wide: sudo R
  4. From the R command prompt, install Rcmdr: install.packages('Rcmdr'). R will ask you to select a CRAN mirror; pick the first, '0-Cloud' mirror, or a mirror site near you.

It is also possible to install R and R packages from the Ubuntu package respository but these are almost always out of date.

When you first load the Rcmdr package with the command library(Rcmdr), it will offer to download and install missingdependencies; allow it to do so.

macOS Installation

These instructions are for R version 3.6.1 or later; if you're using an earlier version of R, I suggest that you upgrade (in fact, it's generally a good idea to upgrade to the current version of R), or, failing that, consult the special macOS installation notes for the R Commander under older versions of R. R 3.6.1only supports macOS version 10.11 (El Capitan) or higher. Please read these instructions carefully, as they are a little complicated.

  • Before installing R and the R Commander, make sure that your macOS system is up-to-date by running Software Update from the 'apple' menu at the top-left of the screen. This is important, because R assumes that the system is up-to-date and may not function properly if it is not.
  • Install the current version of R from the Comprehensive R Archive Network (CRAN), selecting a mirror site near you; a list of CRAN mirrors appears at the upper left of the CRAN home page.
  • Checkto see whether the X11 windowing system (X Windows) has already beeninstalled on your computer. For macOS 10.6 and 10.7, the file X11.appshould appear in the Utilities folder under Applications in thefinder. This application should always be installed under macOS 10.7. For macOS 10.8 or higher, the file is named XQuartz.app and is no longer included with the operating system. XQuartz.app may also be installed in macOS 10.6 or 10.7. (The R Commander uses the tcltk package for R, which requires X-Windows.)

Note that if and when you upgrade macOS, you will have to reinstall XQuartz even if you installed it previously.

  • If neither X11.app nor XQuartz.app is installed, install XQuartz. In fact, regardless of whether some version of X-Windows is installed on your computer, it shouldn't hurt to install the current version of XQuartz.
    • When you open this file by double-clicking on it, you'll find XQuartz.pkg; double-click on it to run the installer, clicking through all the defaults.
    • After the installer runs, you'll have to log out and back on to your macOS account, or just reboot your computer.
  • StartR by running R.app. At the > command prompt, type the followingcommand and press the return key:

install.packages('Rcmdr')

Rwill ask you to select a CRAN mirror; pick the first, '0-Cloud' mirror, or a mirror site near you.
  • Once it is installed, to load the Rcmdr package, simply issue the command
    library(Rcmdr)
    at the R > command prompt and press return. When you first load the Rcmdr package, it will offer to download and install missingdependencies; allow it to do so.
  • Suppressing 'app nap': Under macOS 10.9 ('Mavericks')or later, the R Commander may slow down or occasionally hesitate to display a menu as your session progresses. This behaviour is due to macOS 10.9 or later saving power by going into 'nap' mode when the R.app window is not visible.I am aware of several solutions (beyond always inconveniently insuring that the top of the R.app window is visible). The first solution is simplest.

    (1) You can suppress app nap via the R Commander Tools -> Manage macOS app nap for R.app menu. Select the radio button to set app nap off in the resulting dialog box. This setting is permanent across R.app sessions until you change it.

    (2) You can avoid the problem by running R in a terminal window rather than using R.app. There really is no reason to prefer running the R Commander in R.app, so using R from a terminal should be perfectly fine .
    • Open the Utilities subfolder inside the Applications folder on your Mac. Click on Terminal.app to open a terminal window.
    • At the Unix command prompt in the terminal window, type R and press the enter (or return) key. On my Mac, the Unix command prompt looks like this: john-fox-mbp:~ jfox$
    • Once R starts up, you'll see the usual initial messages, followed by the R command prompt, >
    • As usual, type library(Rcmdr) at the R prompt and press the enter key.
    • After you exit from the R Commander, you can safely close the terminal window, whether or not you have exited from R.

    (3) You can prevent your computer from napping when R.app is running, even if it's not visible, by right-clicking (or control-clicking) on R.app in the Applications folder in the Finder, and selecting Get Info from the context menu. Check the box next to Prevent App Nap. The change is permanent until you reverse it by unchecking the box. This solution only works with the snowleopard build of R.app.

    (4) Enter the following command in a Mac terminal window at the Unix command prompt:

    defaults write org.R-project.R NSAppSleepDisabled -bool YES

    This is the manual equivalent of solution (1), and is permanent until reversed.

R Commander Mac Installieren

macOS Trouble-shooting

R Commander Download For Mac

As part of the installation process, XQuartz builds a font cache. Occasionally, the font cache isn't built on installation, and instead the cache is built when the R Commander (and hence XQuartz) is first used. This process can be time-consuming and may initially slow down the performance of the R Commander (with, e.g., dialog boxes taking a long time to display); if this problem occurs, please be patient -- the problem should resolve itself after the font cache is built.

If you are using macOS 10.9 ('Mavericks') or later and the R Commander becomes slow or unresponsive during a session, you can run R and the R Commander in a terminal window on your Mac rather than from R.app or prevent your computer from 'napping' while R.app is running. See 'Suppressing app nap' in the installation notes above.

Occasionally, the Rcmdr package will fail to load properly in macOS. When this problem occurs, the cause is almost always the failure of the tcltk package to load --The Rcmdr package depends on the tcltk package. You can confirm this diagnosis by trying to load the tcltk package directly, in a fresh R session, issuing the command library(tcltk)at the R command prompt.

  • If you are running R version 3.1.2, the tcltk package may fail to load with a message like the following. This is due to a bug in R 3.1.2, which assumes that the otool utility is installed on your system, and which fails if it is not. The simplest fix is to install a newer version of R.
  • Error : .onLoad failed in loadNamespace() for 'tcltk', details:
    call: system2('otool', c('-L', shQuote(DLL)), stdout = TRUE)
    error: error in running command
    Error: package or namespace load failed for ‘tcltk’
    sh: otool: command not found

  • If the tcltk package fails to load with a message like the following, then your system has an old version of X-Windows that is incompatible with the version of Tcl/Tk for X-Windows that's distributed with R. The probable solution is to run Mac OS Software Update, as suggested in the steps above -- or just install the current version of XQuartz.

    Error : .onLoad failed in loadNamespace() for 'tcltk', details:
    call: dyn.load(file, DLLpath = DLLpath, ..)
    error: unable to load shared object
    '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so':

    dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so,
    10): Library not loaded: /usr/X11/lib/libfreetype.6.dylib
    Referenced from: /usr/local/lib/libtk8.6.dylib
    Reason: Incompatible library version: libtk8.6.dylib requires version
    14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0

  • If the tcltk package fails to load with a message like the following, then your system has inappropriate file permissions set for the /usr/local directory or a subdirectory of it, probably by misbehaving software.

    Error : .onLoad failed in loadNamespace() for 'tcltk', details:
    call: dyn.load(file, DLLpath = DLLpath, ..)
    error: unable to load shared object
    '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/
    tcltk.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk
    /libs/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.6.dylib
    Referenced from:
    /Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/t
    cltk.so
    Reason: no suitable image found. Did find:
    /usr/local/lib/libtcl8.6.dylib: stat() failed with errno=13
    /usr/local/lib/libtcl8.6.dylib: stat() failed with errno=13
    Uninstaller free for mac.

You can verify the source of this problem by issuing the following command at the R command prompt:

system('ls -ld /usr/local /usr/local/lib /usr/local/lib/libtcl*')

If there is a file-permissions problem, you should see something like

ls: /usr/local/lib: Permission denied
ls: /usr/local/lib/libtcl*: Permission denied
drwx------ 8 root wheel 272 Sep 24 10:21 /usr/local

R Commander Mac Slow

Having confirmed the problem, you can change the file permissions in /usr/local by opening a terminal window on your Mac (Terminal.app is in the Applications Utilities folder), and entering the following command at the $ prompt in the terminal window:

    sudo chmod -R a+rX /usr/local

The operating system will ask you to supply your password to execute this command.

Installing Optional Pandoc and LaTeX Software

Installing R and the Rcmdr package is sufficient for creating HTML (web page) reports via the R Markdown document that the R Commander builds for each session, but if you prefer to create editable Word or Open Office documents or PDF files for reports, you will have additionally to install Pandoc and LaTeX (the latter, in conjunction with Pandoc, for PDF reports). The most convenient way to do this is via the R Commander Tools > Install auxiliary software menu (which appears only if Pandoc or LaTeX is absent).

Last modified: 2020-04-24 by John Fox <jfoxAT mcmaster.ca>.

These installation notes are intended for Mac OS X users of versions of R prior to R 3.0.0. R version 3.0.0 comes with an X-Windows installation of Tcl/Tk, and it is thus unnecessary to install Tcl/Tk for X Windows in a separate step.

I strongly recommend that you upgrade to the current version of R, and then follow the standard R Commander installation notes for Mac OS X users. Using an old version of R will restrict you to an old version of the R Commander as well, and these old versions are now unsupported.

The Rcmdr package is a standard R package, and it installs andis loaded in the normal manner. There are, however, a few installation issues on Macintosh systems, and these are described in this document.

A general point is keep is mind is that the Rcmdr package usesa number of other 'contributed' packages (in addition to packages,such as tcltk and MASS, that are part of the standard R distribution), and thesemust be present for it to work properly: abind, aplpack, car, colorspace, effects, Hmisc, leaps, lmtest, multcomp, relimp, rgl. Many of these packages have their own dependencies, which depend on still other packages, etc.

Once it is installed, to load the Rcmdr package, just enter thecommand library(Rcmdr).

Theprocedure for installing the R Commander under Mac OS X for versions of R prior to 3.0.0 is a bitcomplicated, so please read and follow these instructions carefully.These instructions and the associated files are intended for Mac OS X10.5 (Leopard), 10.6 (Snow Leopard), 10.7 (Lion), and 10.8 (Mountain Lion) systems. I assume that you've already installed R.

  • Checkto see if the X11 windowing system (X Windows) has already beeninstalled on your computer. For OS X 10.5, 10.6, and 10.7, the file X11.appshould appear in the Utilities folder under Applications in thefinder. This application should always be installed under OS X 10.7. If X11.app is missing under OS X 10.5 or 10.6, you can install it from your Mac OS Xinstallation disc as follows:
    • Insert your Mac OS X install disc. (If you have two discs it will be on the'Install Disc 1').
    • Double click on Optional Installs.
    • Double click on Optional Installs.mpkg, then click Continue and accept the license agreement.
    • Click the triangle next to Applications in order to expand the list of applications.
    • Check 'X11', and then click Continue and Install. Click Close when the installation finishes.

    Under OS X 10.8 (Mountain Lion), the X11 application is called XQuartz.app, and it is no longer included with the operating system.

    • When you first try to use X11, however -- for example, by installing and then loading the Rcmdr package in R (see the bullets below) -- OS X will offer to help you install X11, with a message like 'To open 'R,' you need to install X11. Would you like to install X11 now?'
    • Click the continue button, which will take you to the Apple support website, and thence to http://xquartz.macosforge.org, where you can download the disk image (dmg) file for XQuartz.
    • When you open this file by double-clicking on it, you'll find XQuartz.pkg; double-click on it to run the installer, clicking through all the defaults.
    • After the installer runs, you'll have to log out and back on to your Mac OS X account.
  • Install Tcl/Tk for X Windows. Note that this step is necessary only for versions of R prior to R 3.0.0. Installers (tcltk-8.5.5-x11.dmg or tcltk-8.5.5-x11.pkg) for various versions of Mac OS X are available

R Commander For Mac

  • InstallTcl/Tk for X Windows by double-clicking on the downloaded filetcltk-8.5.5-x11.dmg and then double-clicking on the installer filetcltk.pkg, or by double-clicking on the downloaded file tcltk-8.5.5-x11.pkg.
  • Under OS X 10.8 (Mountain Lion), depending upon how your security preferences are set, you may see the message, 'tcltk.pkg' can't be opened because it is from an unidentified developer.' At this point, you can proceed by clicking OK to close the message box; then right-clicking (or control-clicking) tcltk.pkg; and finally clicking the Open button in the resulting dialog box. On the other hand, you might get tired of Apple trying to restrict the software that you install on your Mac, and simply change your security and privacy preferences to 'allow applications downloaded from anywhere.'
  • Continue through the installation.
  • StartR by running R.app. At the R > command prompt, type the followingcommand and press the return key (to avoid errors, you can copythe command from this document and paste it at the R > commandprompt):

Download R Commander For Mac

install.packages('Rcmdr')

Rwill ask you to select a CRAN mirror; pick a mirror site near you.
  • Once it is installed, to load the Rcmdr package, simply issue the command
    library(Rcmdr)
    at the R > command prompt and press return. When you first load the Rcmdr package, it will offer to download and install missingdependencies; allow it to do so. Note that under Mac OS X 10.8 (Mountain Lion) you will likely have to install XQuartz.app at this point (see above).

Last modified: 2015-01-22 by John Fox <jfoxAT mcmaster.ca>.