📚 Programming Tutorial

R Programming

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.

R Programming Tutorial Index

57 Topics

📘 Introduction

📘

Overview of R

Learn what R is, its features and where it is used for statistics and data analysis.

⬇️

Installing R

Learn how to download and install R and RStudio on Windows, Linux and macOS.

▶️

Running R

Learn the ways of running R: the console, script files and RStudio.

💬

Comments in R

Learn how to write comments with # to document R code.

🧮

Variables in R

Learn how to create variables, assign values and follow the naming rules.

🔢

Datatypes in R

Learn the basic data types: numeric, integer, character, logical and complex.

🔄

Type conversion in R

Learn how to convert values from one data type to another.

⌨️

Input & Output Functions in R

Learn how to read input and display output using functions such as readline(), scan(), print() and cat().

➕

Operators in R

Learn the arithmetic, relational, logical and assignment operators of R.

🧱

Objects in R

Learn what objects are in R and how their attributes and classes work.

✂️

Sub setting R Objects

Learn how to extract parts of vectors, lists, matrices and data frames.

📦

Packages in R

Learn how to install, load and use packages in R.

🎯

Rounding in R

Learn the rounding functions round(), signif(), ceiling(), floor() and trunc().

🌀

Complex numbers in R

Learn how to create and work with complex numbers in R.

🔀 Control Structures

🔀

Control Structures in R

Learn decision making and looping in R: if, if-else, for, while, repeat, break and next.

⚙️ Functions

⚙️

Functions in R

Learn how to define and call functions, and how arguments, default values and return values work.

📏 Vector

📏

Vectors in R

Learn how to create vectors and the basic operations on them.

🔎

Vector Indexing

Learn how to access vector elements using positive, negative, logical and named indexes.

✏️

Adding and Deleting Vector Element

Learn how to add elements to a vector and delete elements from it.

📐

Obtaining the Length of a Vector

Learn how to find the number of elements of a vector.

🔲

Matrices and Arrays as Vectors

Learn how matrices and arrays are stored and handled as vectors.

➗

Vector Arithmetic and Logical Operations

Learn element-wise arithmetic, recycling and logical operations on vectors.

📅

Dates and Times in R

Learn how to work with dates and times in R.

🗒️ Lists

🗒️

Creating Lists in R

Learn how to create lists that hold elements of different types.

🛠️

General List Operations

Learn the common operations on lists such as indexing, naming and modifying elements.

🧹

Adding and Deleting List Elements

Learn how to add elements to a list and delete elements from it.

📏

Getting the Size of a List

Learn how to find the size of a list.

🧪

Extended Example

Work through an extended example that applies the list operations.

🗝️

Accessing List Components and Values

Learn how to access list components and their values.

🔁

Applying Functions to Lists

Learn how to apply a function to every element of a list with lapply() and sapply().

🗃️ Data Frame

🗃️

Creating a Data Frame

Learn how to create data frames and how to read data into them.

🔓

Accessing Data Frames

Learn how to access the rows, columns and cells of a data frame.

🧪

Extended Example

Work through an extended example that applies the data frame operations.

🧮

Other Matrix-Like Operations

Learn matrix-like operations on data frames such as extracting subsets, rbind(), cbind() and apply().

🏷️ Factors

🏷️

Factors and Levels

Learn how factors store categorical data as levels.

🧰

Common Functions Used with Factors

Learn the common functions used with factors such as tapply(), split() and by().

📊 Tables

📊

Working with Tables

Learn how to create tables of counts and work with them.

🔳

Matrix/Array-Like Operations on Tables

Learn how to apply matrix-like and array-like operations to tables.

✂️

Extracting a Subtable

Learn how to extract a part (subtable) of a table.

🏆

Finding the Largest Cells in a Table

Learn how to find the cells with the largest counts in a table.

➗ Math Functions

➗

Math Functions

Learn the built-in math functions of R such as sqrt(), exp(), log() and abs().

🎲

Calculating a Probability

Learn how to calculate a probability in R with a worked example.

🧾

Cumulative Sums and Products

Learn how to compute cumulative sums and products with cumsum() and cumprod().

↕️

Minima and Maxima

Learn min(), max(), pmin(), pmax(), which.min() and which.max().

🔔

Functions for Statistical Distributions

Learn the d, p, q and r functions for statistical distributions such as the normal and binomial.

📈 Graphics

📉

Creating Graphs

Learn how to create graphs in R with plot(), lines(), hist() and barplot().

🎨

Customizing Graphs

Learn how to customize the titles, labels, colors, symbols and axes of a graph.

💾

Saving Graphs to Files

Learn how to save graphs to PNG, JPEG and PDF files.

🧊

Creating Three-Dimensional Plots

Learn how to create three-dimensional plots in R.

🐞 Debugging

🐞

Fundamental Principles of Debugging

Learn the basic principles of finding and fixing errors in a program.

❓

Why Use a Debugging Tool?

Understand why a debugging tool is better than adding print statements.

🔧

Using R Debugging Facilities

Learn the debugging facilities of R such as debug(), browser() and traceback().

🪜

Moving Up in the World

Learn how to move up and down the call stack while debugging.

🔁

Ensuring Consistency in Debugging Simulation Code

Learn how to get repeatable results when debugging simulation code.

⚠️

Syntax and Runtime Errors

Learn how to find and fix syntax errors and runtime errors.

🖥️

Running GDB on R Itself

Learn how to run the GDB debugger on R itself.

🔍

No topics found
Try another search term.