Study Material

Study Material

Learn Data Science with R Programming – Comprehensive Video Tutorials & Practical Assignments

Video Tutorials
Study Material

Data Science R Programming Tutorial

Introduction to R Programming

Data Visualization with ggplot2

Introduction to R Programming

R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.

Key Features:

  • Effective data handling and storage facility
  • A suite of operators for calculations on arrays, lists, vectors and matrices
  • Large, coherent, integrated collection of intermediate tools for data analysis
  • Graphical facilities for data analysis and display
  • Well-developed, simple and effective programming language

Basic Syntax

Here’s a simple example of R syntax to calculate the mean of numbers:

numbers <- c(10, 20, 30, 40, 50)
mean(numbers)

Data Structures in R

R has several data structures that help in organizing data efficiently:

Vectors

A vector is the simplest type of data structure in R. It contains items of the same type.

# Create a numeric vector
num_vector <- c(1, 2, 3, 4, 5)

Lists

Lists can contain elements of different types like numbers, strings, vectors and even another list.

# Create a list
my_list <- list("Red", c(1,2,3), TRUE, 51.23)

Data Frames

Data frames are tabular data objects where each column can contain different modes of data.

# Create a data frame
df <- data.frame(
  name = c("John", "Alice", "Bob"),
  age = c(25, 30, 28),
  stringsAsFactors = FALSE
)
Download PDF