Getting started with R

This blogpost was for a friend who needed help learning R. If you're new to R, this should help you too. Also, I'm quite new to R myself and am not an expert by any means.

Introduction

R is a really simple language you can use to study and analyze data. You can also generate graphs like the one below.

Installing R

Windows

  1. Download the setup for R from CRAN: https://cran.r-project.org/bin/windows/base/
  2. Run the setup and follow the steps on screen to complete installation

OS X

  1. Download R from CRAN: https://cran.r-project.org/bin/macosx/
  2. Run the setup and follow the onscreen instructions.

R can also be easily installed using homebrew. Ensure you've got homebrew setup first. Then install the r package using homebrew by typing the following in the terminal:

$ brew install package r

Linux

The following worked on my VM running Ubuntu 16.04 LTS

$ sudo apt-get install r-base

If that doesn't work for you, follow the instructions here.

R Fiddle

If you don't want to install R on your computer yet, you can use R Fiddle. You'll eventually want to have R installed though.

R Studio

R Studio is a nice cross platform IDE for R. You can download and install it from here.
R-Studio is free only for non-commercial use.

Learning R

I found 4 good resources that helped me get started. The first two are particularly very good.

  1. R: A Self Learn Tutorial (PDF) by National Center for Ecological Analysis and Synthesis, California.
  2. Video Lessons by Neo Christopher Chung and David Robinson.
  3. Beginner's guide to R by Computer World. The PDF available can be downloaded from here on registration.
  4. An interactive R tutorial by CodeSchool for those who like it slow.

As with learning any other programming language, typing the code/command is important. Don't copy-paste. Always type. And type as many commands as you can. Even the examples. You might not like it at first, but you'll thank yourself later.

Getting help

If you get stuck, try using google search. Or check the R documentation here. If these don't help try asking someone.

Stackoverflow & Cross Validated are sister-sites you can get help from. Ask on stackoverflow if your question is more programming related, and on Cross Validated if your question is more statistics related. Make sure you read the Help Center of the respective sites before posting a question.


I've been working on a really cool project for quite sometime now and I can't wait to use R to study its data :D