R Programming Tutorial

In this R Programming Tutorial, we explain everything about linear and nonlinear modeling, data analysis, and time-series analysis to a great extent. Its easy coding, wide number of packages, and Free software are making data scientists interested in this language.

R is a programming language that provides a software environment for graphics, statistical computing, data science, and machine learning, and we explain most of them in this tutorial. It also provides a wide variety of graphical techniques.

What is R Programming?

R is an interpreted programming language created by Ross Ihaka and Robert Gentleman, helpful in statistical computing, data analysis, and data visualization. Similar to any other programming language, R supports operators, conditional statements, loops, and objects (vectors, matrices, lists, arrays, etc).

R is open-source software available for various operating systems, including Windows, Mac, and Linux. It offers a wide variety of packages to perform operations on objects, including ggplot2, lattice, shiny, etc.

R Hello World Program

The Hello World program helps you understand how we can write and print a simple message as output. Here, we use the built-in print() method to display Hello World!”.

NOTE: As it is a one-line code, I wrote this print() statement in the console.

> print("Hello World!")
[1] "Hello World!"

Download and Installation of R software

Use the hyperlinks in this section to understand the steps involved in downloading R software and installing it on Windows or any other operating system. Next, download and set up RStudio to write the first program. Then install the required packages.

  1. Software Download
  2. Install Software
  3. Download and Install RStudio
  4. Install R packages

List of Operators

  1. Arithmetic Operators
  2. Comparison Operators
  3. Logical Operators

R Decision Making & Loops

Loops help execute a fixed number of lines several times. The control structures allow us to control the execution flow of a series of statements or expressions. Based on the condition or input, control structures will respond by executing the expressions.

The following R programming tutorial explains the loops and the decision-making statements with a practical example.

  1. If Statement
  2. If Else Statement
  3. Else If Statement
  4. Nested If Statement
  5. Switch Statement
  6. Break Statement
  7. Next Statement
  8. While Loop
  9. For Loop
  10. Repeat Loop

R Programming Objects

R is all about objects because this Programming always works with objects. The following list is the available objects to work with data.

  1. Vectors
  2. Matrix
  3. Arrays
  4. Lists
  5. Data Frame

Learn about Functions

  1. Introduction to Functions
  2. Recursive Functions

The math page shows the list of available mathematical functions, such as abs, sqrt, ceiling, floor, and round.

Learn R Data Sources

  1. Read Data from SQL Server
  2. Read Data from CSV File
  3. Import Data From Text File using read.table

R Data Visualization (Charts & Graphs)

This section of the R programming tutorial explains the graphs and charts available to visualize data.

  1. Bar Chart
  2. Stacked & Clustered Bar Chart
  3. Pie Chart
  4. Scatter Plot
  5. Histogram
  6. Boxplot
  7. Stem and Leaf Plot
  8. Mosaic Plot

Lattice Package

  1. Lattice Histogram
  2. Lattice Scatter Plot
  3. Lattice Bar Chart

ggplot2 Package

The following are list of available R Programming charts in the ggplot2 package. Please use the links to see the example of each plot.

  1. ggplot2 Boxplot
  2. ggplot2 Density Plot
  3. ggplot2 Dot Plot
  4. ggplot2 Histogram
  5. ggplot2 Jitter
  6. ggplot2 Line Plot
  7. ggplot2 Scatter Plot
  8. ggplot2 Violin Plot
  9. Save ggplot

Comments are closed.