Tutorials     About     RSS
Tech and Media Labs

R Tutorial

Jakob Jenkov
Last update: 2015-11-12

R is a programming language targeted at data science. Thus, R contains a lot of functions for working with data. This spans from various ways of loading different types of data files (e.g. data exported from Excel) to all kinds of mathematical functions on that data. For instance, R supports statistical calculations, vector calculations and matrix calculations, just to mention a few.

R also has functions for data visualization, meaning R can draw diagrams from data. This is helpful if you have to generate diagrams for a report or presentation. This also is really helpful when searching for patterns or trends in data.

R is a language intended for non-programmers, meaning people with a mathematical or business background who don't know much about programming in general. That is why R contains a lot of high level functions which are relatively easy to use and understand, also for non-programmers.

This R programming tutorial will help you learn the R programming language. Since R is intended for non-programmers I have tried to write this R tutorial for non-programmers too. Since I am a programmer myself, I may have failed here and there. If there is something you don't understand, drop me a comment in the comment box below the page, or write us an email (see About page for an email address).

We may not react immediately because we are pretty busy, but we usually get around to it sooner or later. Even if you find the answer in the meantime, future readers might still benefit from the clarifications resulting from your feedback.

R Programming Tools

There are three important tools you need to learn when getting started with R. These are the R runtime, R Studio and R packages. All three are described in a bit more detail below, and in even more detail in separate texts (web pages) in this tutorial trail. See the menu in the let side of this page for more texts related to R programming.

All of the R tools can run on Windows, Mac and Linux.

R Runtime

The first R tool to know is the R runtime which can execute R programs. The R runtime is required to run R programs. You activate the R runtime from the command line. You pass the file name of an R program to the R runtime, and the Runtime executes the R program. The R runtime is great when you need to execute the same R program many times, possibly on different data sets.

The R runtime is free, open source, and can be found here:


R Studio

The second tool to know is R Studio. R Studio is an visual, interactive editor where you can work with R. In R studio you can run R snippets (small R programs) directly and see the result. You can also import data and run R functions against that data, one at a time. R Studio can also execute R programs which are stored in their own files, just like the R runtime.

R Studio is great when you need to explore data without knowing ahead of time exactly what type of analysis you need to do. You can just load the data and run various different mathematical functions against it, until you find out the right strategy to analyze that type of data. Then you might write an R program that carries out that analysis so you can repeat it easily in the future with new, similar data sets.

R Studio is also a great way to learn the R programming language. You just open R studio and type in R statements and have them executed one by one. The results are visible immediately inside R studio.

R Studio is also free, and can be found here:


R Packages

In addition to the R runtime and R Studio lots of people have contributed R packages which you can use freely. An R package is a set of functions that perform some analysis job on some kind of data (typically - although an R package can be other things too).

Using pre-programmed R packages can sometimes make your analysis job easier. You don't have to know exactly how to program a certain mathematical function in R (if it is not already supported in R). You may not even have to understand how the math behind the function works. You can just call the functions in the R package and get the results.

Further Resources About R Programming

This page is only the first of many in this tutorial trail about R programming. See the menu on the left for more texts about R. Or continue to the next text in this trail using the "Next" link below.

There are also a few well established websites you should know about as R programmer. I have summed them up in the table below:

http://www.r-bloggers.com A website with news and articles about R.
http://www.r-users.com A website with R jobs.

Jakob Jenkov

Featured Videos

Thread Congestion in Java - Video Tutorial

Sponsored Ads

Maildroppa - Smart Email Marketing Solution
Close TOC

All Trails

Trail TOC

Page TOC