r setup and environment

Upload: nip-sweetie

Post on 07-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 R Setup and Environment

    1/3

  • 8/6/2019 R Setup and Environment

    2/3

    The R Commander Graphical User Interface

    Several graphical user interfaces (GUIs) are available for R. For elementary statistical use, the R Commanderis the most mature. It installs as an R package. To install the R Commander from the comamnd line, enter:

    install.packages("Rcmdr", dependencies=TRUE)

    Among the dependencies are the graphics packages rgl (3D dynamic graphics), scatterplot3d, vcd (visualizationof categorical data) and colorspace (for generation of color palettes, etc).

    2 Running R from an editor

    The use of an editor interface to R gives additional functionality. The most powerful and versatile of these isthe ESS1 interface to the XEmacs editor, or perhaps to the more cryptic Emacs editor. Most other commonlyused editors are platform specific.

    Windows users should consider the highly customizable Tinn-R editor, which has an elaborate built-ininterface to R. Go to (https://sourceforge.net/projects/tinn-r; see also www.sciviews.org/Tinn-R/).

    2.1 Tinn-R

    Uninstall any earlier version. Download and install Tinn-R from https://sourceforge.net/projects/tinn-r.Start up Tinn-R. Ensure that you have a live internet connection. From the drop-down menu, select R |

    Configure | Permanent (Rprofile.site. An Rprofile.site file should appear in a Tinn-R window. For now, thisshould be satisfactory as it is. You will be asked if you wish to start R. Upon starting R, installation of thepackages that are necessary to access R from Tinn-R should start automatically.

    Iconography

    The tools on the toolbars are a suggestion. To make changes to the R toolbar, go to Options | Application | R| General | Resources. To make additions or deletions to the main toolbars go to View | Toolbars.

    Go to Options | Application | R | General | Resources Go to View | Toolbars.

    Use of a relevant menu item to send code to R

    Click on File on the text menu at the top of the Tinn-R window, and select New. This creates a file window,with the name Untitled1, as shown in the image.

    1http://ess.r-project.org/)

    2

    https://sourceforge.net/projects/tinn-rhttps://sourceforge.net/projects/tinn-rhttp://www.sciviews.org/Tinn-R/https://sourceforge.net/projects/tinn-rhttps://sourceforge.net/projects/tinn-rhttp://ess.r-project.org/http://ess.r-project.org/http://ess.r-project.org/https://sourceforge.net/projects/tinn-rhttp://www.sciviews.org/Tinn-R/https://sourceforge.net/projects/tinn-r
  • 8/6/2019 R Setup and Environment

    3/3

    Into the window just created,type, e.g., 2+2. Leaving thecursor on that same line, clickon Send current line (to R). Thissends 2+5 to R, which executesthe calculation.

    Explanatory text appears whenthe mouse pointer hovers on anicon.

    Another possibility is to selectthe whole line, and click theSend selection icon, which is onthe far left.

    2.2 Emacs under Windows

    Another possibility is to install Emacs (or perhaps XEmacs) and ESS. This offer a powerful editing environment.Novices may find the Emacs command interface overly cryptic, though most simple tasks can now be done fromthe GUI. A version of Emacs for Windows that has ESS and other additions is available fromhttp://vgoulet.act.ulaval.ca/en/ressources/emacs/

    FAQs for R, for R MacOS X, and for R for Windows, can be accessed from a CRAN mirror site, or directlyfrom an R session by typing help.search().

    3 R under Mac OSX

    The binary installs a Unix version that can be run from the command line, plus a MacOS X application thatruns R from a Cocoa-based Gui. Fire up the application, and explore the features that are available from themenu system. The editor is fairly basic, but does have syntax highlighting. The menu has helpful abilities forchecking what packages and versions have been installed and for installing and upgrading packages.

    MacOS X users have the further options of running R from the Unix command line, or via the ESS interfaceas an Emacs/XEmacs process. You may need to type, from a terminal window:

    sudo ln -s /Library/Frameworks/R.framework/Resources/R /usr/local/bin/R

    Recommended Emacs/XEmacs ports (for use with ESS) are: Aquaemacs at http://sourceforge.net/projects/aquamacs/ (Mac-like user interface), XEmacs at http://sourceforge.net/projects/xemacs/(Graph-ical user interface support), or Carbon Emacs at http://homepage.mac.com/zenitani/emacs-e.html (GNUEmacs, with Mac-friendly features).

    The quartz graphics device is available irrespective of the interface. The X11 device is also in principleavailable, but depending on the version of MacOS X, various components of X11 may need to be installed. Forversion 10.5 (Leopard), go to http://trac.macosforge.org/projects/xquartz.

    4 R under Unix and Linux

    For R binaries, see http://cran.ms.unimelb.edu.au/bin/linux/. For Unix and some flavours of Linux, itwill probably be necessary to compile the R source. This is straightforward providing that you have the neededcompilers, etc. Check the R FAQ at http://cran.ms.unimelb.edu.au/doc/FAQ/R-FAQ.html.

    For GNU Emacs, go to http://www.gnu.org/software/emacs/ For XEmacs, go to http://www.xemacs.org/ Alternatives to the Emacs/XEmacs editor include Kate, under either the KDE or the Gnome Windowmanager.

    3

    http://vgoulet.act.ulaval.ca/en/ressources/emacs/http://sourceforge.net/projects/aquamacs/http://sourceforge.net/projects/aquamacs/http://sourceforge.net/projects/xemacs/http://homepage.mac.com/zenitani/emacs-e.htmlhttp://trac.macosforge.org/projects/xquartzhttp://trac.macosforge.org/projects/xquartzhttp://cran.ms.unimelb.edu.au/bin/linux/http://cran.ms.unimelb.edu.au/doc/FAQ/R-FAQ.htmlhttp://www.gnu.org/software/emacs/http://www.xemacs.org/http://www.xemacs.org/http://www.xemacs.org/http://www.xemacs.org/http://www.gnu.org/software/emacs/http://cran.ms.unimelb.edu.au/doc/FAQ/R-FAQ.htmlhttp://cran.ms.unimelb.edu.au/bin/linux/http://trac.macosforge.org/projects/xquartzhttp://homepage.mac.com/zenitani/emacs-e.htmlhttp://sourceforge.net/projects/xemacs/http://sourceforge.net/projects/aquamacs/http://sourceforge.net/projects/aquamacs/http://vgoulet.act.ulaval.ca/en/ressources/emacs/