Overview of R
Learn what R is, its features and where it is used for statistics and data analysis.
R is an open-source programming language and software environment for statistical computing, data analysis and graphics. This tutorial covers R from the basics to vectors, lists, data frames, graphics and debugging.
Learn what R is, its features and where it is used for statistics and data analysis.
Learn how to download and install R and RStudio on Windows, Linux and macOS.
Learn the ways of running R: the console, script files and RStudio.
Learn how to write comments with # to document R code.
Learn how to create variables, assign values and follow the naming rules.
Learn the basic data types: numeric, integer, character, logical and complex.
Learn how to convert values from one data type to another.
Learn how to read input and display output using functions such as readline(), scan(), print() and cat().
Learn the arithmetic, relational, logical and assignment operators of R.
Learn what objects are in R and how their attributes and classes work.
Learn how to extract parts of vectors, lists, matrices and data frames.
Learn how to install, load and use packages in R.
Learn the rounding functions round(), signif(), ceiling(), floor() and trunc().
Learn how to create and work with complex numbers in R.
Learn decision making and looping in R: if, if-else, for, while, repeat, break and next.
Learn how to define and call functions, and how arguments, default values and return values work.
Learn how to create vectors and the basic operations on them.
Learn how to access vector elements using positive, negative, logical and named indexes.
Learn how to add elements to a vector and delete elements from it.
Learn how to find the number of elements of a vector.
Learn how matrices and arrays are stored and handled as vectors.
Learn element-wise arithmetic, recycling and logical operations on vectors.
Learn how to work with dates and times in R.
Learn how to create lists that hold elements of different types.
Learn the common operations on lists such as indexing, naming and modifying elements.
Learn how to add elements to a list and delete elements from it.
Learn how to find the size of a list.
Work through an extended example that applies the list operations.
Learn how to access list components and their values.
Learn how to apply a function to every element of a list with lapply() and sapply().
Learn how to create data frames and how to read data into them.
Learn how to access the rows, columns and cells of a data frame.
Work through an extended example that applies the data frame operations.
Learn matrix-like operations on data frames such as extracting subsets, rbind(), cbind() and apply().
Learn how factors store categorical data as levels.
Learn the common functions used with factors such as tapply(), split() and by().
Learn how to create tables of counts and work with them.
Learn how to apply matrix-like and array-like operations to tables.
Learn how to extract a part (subtable) of a table.
Learn how to find the cells with the largest counts in a table.
Learn the built-in math functions of R such as sqrt(), exp(), log() and abs().
Learn how to calculate a probability in R with a worked example.
Learn how to compute cumulative sums and products with cumsum() and cumprod().
Learn min(), max(), pmin(), pmax(), which.min() and which.max().
Learn how to do derivatives and integrals in R.
Learn the d, p, q and r functions for statistical distributions such as the normal and binomial.
Learn how to create graphs in R with plot(), lines(), hist() and barplot().
Learn how to customize the titles, labels, colors, symbols and axes of a graph.
Learn how to save graphs to PNG, JPEG and PDF files.
Learn how to create three-dimensional plots in R.
Learn the basic principles of finding and fixing errors in a program.
Understand why a debugging tool is better than adding print statements.
Learn the debugging facilities of R such as debug(), browser() and traceback().
Learn how to move up and down the call stack while debugging.
Learn how to get repeatable results when debugging simulation code.
Learn how to find and fix syntax errors and runtime errors.
Learn how to run the GDB debugger on R itself.