Data Analytics Using R Intro To R
Data Analytics Using R Intro To R
Analytic
s
Introduction to R
INTRODUCTION TO R
R is a statistical programming language commonly used for statistical analysis, data
visualization, and other forms of data manipulation.
DICT Cordilleras
R STUDIO
IDE
Environmen
t
Source
Files/Plots/
Control
DICT Cordilleras
Packages
R STUDIO
IDE
How to setup working directory
We can setup the directory in RStudio IDE by using or typing the:
DICT Cordilleras
Arithmetic
DICT Cordilleras
Relational Operators
DICT Cordilleras
Logical Operators
DICT Cordilleras
SPACES BETWEEN CHARACTERS
Spaces between characters do not affect the code. It’s a good practice to add a space between characters to make it easier
to read.
DICT Cordilleras
Order of Operations
DICT Cordilleras
Order of Operations
DICT Cordilleras
Using MultipleParenthesis
DICT Cordilleras
Variables
In programming languages, we need to use various variables to store various information.
Variables are the reserved memory location to store values. As we create a variable in our
program, some space is reserved in memory.
DICT Cordilleras
Variables
In programming languages, we need to use various variables to store various information.
Variables are the reserved memory location to store values. As we create a variable in our
program, some space is reserved in memory.
DICT Cordilleras
Variables Naming Conventions
In programming languages, we need to use various variables to store various information.
Variables are the reserved memory location to store values. As we create a variable in our
program, some space is reserved in memory.
DICT Cordilleras
PROBLEM SOLVING
PROCESS
Tools
OBJECTIVE
Prepare breakfast for the family
PROCEDURE
prepare the pan
add a little oil to the pan get 1 egg
Containers and
break and put the egg in the pan
Ingredients
put salt
cook for 1 minute
remove the egg from the pan repeat process 5 more times
DICT Cordilleras
Data Types and Data Structures
Data Data
Types Structures
DICT Cordilleras
Data Types
DICT Cordilleras
DATA 1 Vectors
STRUCTURES 2 Lists
3 Matrices
4 Arrays
5 Data Frames
6 Factors
DICT Cordilleras
Data Structures
DICT Cordilleras
Vector
In R, a sequence of elements which share the same data type is known as vector
Creating Vectors
DICT Cordilleras
Vector
In R, a sequence of elements which share the same data type is known as vector
Creating Vectors
DICT Cordilleras
Vector
In R, a sequence of elements which share the same data type is known as vector
Creating Vectors
NOTE:c is variable
c() is the combine function
DICT Cordilleras
Vector
In R, a sequence of elements which share the same data type is known as vector
DICT Cordilleras
Vector
In R, a sequence of elements which share the same data type is known as vector
DICT Cordilleras
Data Frame
Comprised of rows and columns, where elements of each column is of the same type
DICT Cordilleras
Data Frame
Comprised of rows and columns, where elements of each column is of the same type
DICT Cordilleras
Data Frame
Comprised of rows and columns, where elements of each column is of the same type
DICT Cordilleras
Data Frame
Comprised of rows and columns, where elements of each column is of the same type
DICT Cordilleras
Installing and Loading Packages
R packages are collections of functions and tools developed by the R community. They increase the power of R by improving
existing base R functionalities, or by adding new ones.
Example:
library(tidyverse): Lets you load and use packages (e.g., tidyverse package)
DICT Cordilleras
Accessing Help in R
DICT Cordilleras
Next : Data Exploration