Book Image

Learning RStudio for R Statistical Computing

Book Image

Learning RStudio for R Statistical Computing

Overview of this book

Data is coming at us faster, dirtier, and at an ever increasing rate. The necessity to handle many, complex statistical analysis projects is hitting statisticians and analysts across the globe. This book will show you how to deal with it like never before, thus providing an edge and improving productivity. "Learning RStudio for R Statistical Computing" will teach you how to quickly and efficiently create and manage statistical analysis projects, import data, develop R scripts, and generate reports and graphics. R developers will learn about package development, coding principles, and version control with RStudio. This book will help you to learn and understand RStudio features to effectively perform statistical analysis and reporting, code editing, and R development. The book starts with a quick introduction where you will learn to load data, perform simple analysis, plot a graph, and generate automatic reports. You will then be able to explore the available features for effective coding, graphical analysis, R project management, report generation, and even project management. "Learning RStudio for R Statistical Computing" is stuffed with feature-rich and easy-to-understand examples, through step-by-step instructions helping you to quickly master the most popular IDE for R development.
Table of Contents (13 chapters)

Installing RStudio


Before you install RStudio, you need to install R. It is possible to have multiple versions of R installed side by side. RStudio will use the latest version by default, but can be configured to use a different installed version.

Installing R

RStudio needs at least R version 2.11, but we highly recommend you to install the latest version.

Installing R on Windows and Mac OS X

To download and install R, point your browser to www.r-project.org, click on Download R (in the text underneath the graphics), and choose a server near where you are. From there, follow the instructions in the Download and install R box. Alternatively, use the Download R! button at www.inside-R.org. This website automatically offers you the most recent R version fitting your computer and operating system.

Installing R on Linux

Automatic R installation is supported for several popular Linux flavors, including Debian, OpenSuse, and Ubuntu.

For OpenSuse, the default installation can be obtained by pointing your web browser to http://software.opensuse.org/search, search for r-base, and install from there. At the moment, the newest R version is available from there.

The R version offered by the package installer is frozen when the operating system is released. We assume that you are familiar enough with tools such as Synaptic or aptitude in order to install the R version that comes with those operating systems. Here, we provide some details on how to install the latest R version on Ubuntu or Debian.

CRAN hosts Debian and Ubuntu repositories, which are as follows:

  1. Add the repository for Ubuntu 12.04 (precise pagnolin) by adding (as root) the following line to your /etc/apt/sources.list file:

    deb http://<your_nearest_cran_mirror>/bin/linux/ubuntu precise/
    
  2. Replace <your_nearest_cran_mirror> with a server near where you live. A list of mirrors can be found at http://cran.r-project.org/mirrors.html. Next, register the security key by typing the following:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
    
  3. Type the following commands to install the R.sudo apt-get update:

    sudo apt-get install r-base
    

Alternatively you can install the latest R now via Synaptic. For Debian 6.05 (squeeze), the line to add to your /etc/apt/sources.list file is deb http://<your_nearest_cran_mirror>/bin/linux/debian squeeze-cran/.

The security key is installed with the following command:

sudo apt-key adv --keyserver subkeys.pgp.net --recv-keys 381BA480

After this, installation proceeds as in Ubuntu.