An Introduction to
R:The Basics
CE Dep, IAUSDJ.ac.ir
14-02-96(4 April, 2017)
[5 min] Introduction to R
[3 min] How to Install R
[2 min] Installing Packages
[8 min] R Studio GUI & Environment
[10 min] R Basics
[15 min] Example, “Regression to Mean”
2.2
 R is object base
 Types of objects (scalar, vector, matrices and
arrays
 Assignment of objects
 Building a data frame
2.3
> 1550+2000
[1] 3550
or various calculations in the same row
> 2+3; 5*9; 6-6
[1] 5
[1] 45
[1] 0
2.4
 NAN (not a number)
 NA (missing value)
 Basic handling of missing values
> x
[1] 1 2 3 4 5 6 7 8 NA
> mean(x)
[1] NA
> mean(x,na.rm=TRUE)
[1] 4.5
2.5
Symbol Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
%%
Modulo (estimates
remainder in a division)
^ Exponential
&, |, ! Logical And, Or, Not
Assign <-
<, ==, >, !=
Lower Than, Equal to,
Grater that, Not Equal
2.6
2.7
 Code Menu-> Run Region-> Run All
 CTRL+ALT+R
 Objects in R obtain values by assignment.
 This is achieved by the gets arrow, <-, and not
the equal sign, =. NewVersion = works for
assign.
 Objects can be of different kinds.
2.8
 R has many built in functions that compute
different statistical procedures.
 Functions in R are followed by ( ).
 Inside the parenthesis we write the object
(vector, matrix, array, dataframe) to which we
want to apply the function.
2.9
 Vectors are variables with one or more values
of the same type.
 A variable with a single value is known as
scalar. In R a scalar is a vector of length 1.
 There are at least three ways to create
vectors in R: (a) sequence, (b) concatenation
function, and (c) scan function.
2.10
 Arrays are numeric objects with dimension
attributes.
 The difference between a matrix and an
array is that arrays have more than two
dimensions.
2.11
 A matrix is a two dimensional array.
 The command colnames
2.12
 In R, string variables are defined by double
quotation marks.
> letters
[1] "a" "b" "c"
2.13
 Select only one or some of the elements in a
vector, a matrix or an array.
 We can do this by using subscripts in square
brackets [ ].
 In matrices or dataframes the first subscript
refers to the row and the second to the
column.
2.14
 Researchers work mostly with dataframes .
 With previous knowledge you can built
dataframes in R
 Also, import dataframes into R.
2.15
 if(cond) expr
 if(cond) cons.expr
 else alt.expr
 Example
1-if(i==0) print(“Yes”)
2- if(i==0) print(“Yes”)
else print(“NO”)
2.16
 for(i in 1:5) print(1:i)
2.17
 for(n in c(2,5,10,20,50)) {
 x <- stats::rnorm(n) cat(n, ": ", sum(x^2), "n", sep
= "")
 }
2.18
 1st
To install R on your MAC or PC you first
need to go to http://www.r-project.org
 Kindly Download & Install R 3.4.0
 2nd
To Install Rstudio go to https://
www.rstudio.com
 Simply Download RStudio Desktop Open
Source License
2.19
 install.packages(“Package name")
 library(Library name)
 CTRL+7
2.20
 library(Library name)
2.21
 igraph, Network Analysis andVisualization
 dnet, Evaluation and Ontology
 swirl, Learn R in R
 You will find all of installed packages at
“Package Pane”
2.22
 g <- make_empty_graph(n = 5) %>%
 add_edges(c(1,2, 2,3, 3,4, 4,5)) %>%
2.23
 Plot(g)
2.24
1
2
3
4
5
2.25
 Start menu-> All
Progtams->Rstudio
 Click On Rstudio Icon
2.26
 RSeek.org
RSeek is a custom search engine that can help you
find information on the official website.
 R-bloggers.com
R-Bloggers.com is a blog aggregator of content
collected from bloggers who write about R.
2.27
2.28
Download it from:
https://www.cs.upc.edu/~rober
t/teaching/estadistica/rprogra
mming.pdf
2.29
Download it from:
http://heather.cs.ucdavis.edu/~
matloff/132/NSPpart.pdf
2.30
Download it from:
https://cran.r-
project.org/doc/contrib/Paradis
-rdebuts_en.pdf
2.31
2.32
“Patience,
ensures victory.”
2.33
Thank you for
your attention.
2.34

More Related Content

PDF
Vectors data frames
 
PDF
K means clustering
PPTX
Hierarchical clustering techniques
PPTX
K means clustering | K Means ++
PPTX
Introduction to Ultra-succinct representation of ordered trees with applications
PPTX
Three way join in one round on hadoop
PPT
2 1 Bzca5e
PPT
Cluster analysis using k-means method in R
Vectors data frames
 
K means clustering
Hierarchical clustering techniques
K means clustering | K Means ++
Introduction to Ultra-succinct representation of ordered trees with applications
Three way join in one round on hadoop
2 1 Bzca5e
Cluster analysis using k-means method in R

What's hot (20)

PDF
Quiz 2-solution
PPT
Multi dimensional arrays
PDF
K means
PPT
Modeling quadratic fxns
PPTX
Project PPT
PPTX
Alg2 lesson 7-7
PPTX
Alg2 lesson 7.7
PPT
PDF
11 1. multi-dimensional array eng
PPT
K mean-clustering algorithm
PPTX
K-means clustering algorithm
PPT
Piecewise function lesson 3
PDF
K means and dbscan
PPT
Chapter 7 ds
PPTX
Computation Assignment Help
PPT
K means Clustering Algorithm
PPTX
Prac 3 lagrange's thm
Quiz 2-solution
Multi dimensional arrays
K means
Modeling quadratic fxns
Project PPT
Alg2 lesson 7-7
Alg2 lesson 7.7
11 1. multi-dimensional array eng
K mean-clustering algorithm
K-means clustering algorithm
Piecewise function lesson 3
K means and dbscan
Chapter 7 ds
Computation Assignment Help
K means Clustering Algorithm
Prac 3 lagrange's thm
Ad

Similar to Introduction to R r.nabati - iausdj.ac.ir (20)

PPT
R tutorial for a windows environment
PPTX
R programming
PPT
R Programming Intro
PPTX
Project 11 - R Programming Basics_20250428_063125_0000.pptx
PPT
Loops and functions in r
PPTX
R Language Introduction
PPTX
Programming in R
PDF
Basic R Data Manipulation
PDF
Introduction to R
PDF
R basics
PPTX
statistical computation using R- an intro..
PPT
Brief introduction to R Lecturenotes1_R .ppt
PPT
R_Language_study_forstudents_R_Material.ppt
PPT
Lecture1_R Programming Introduction1.ppt
PPTX
PDF
R programming intro with examples
PPTX
Arrays with the help of Computer Programming
PDF
Introduction2R
PPT
Modeling in R Programming Language for Beginers.ppt
PPT
Lecture1_R.ppt
R tutorial for a windows environment
R programming
R Programming Intro
Project 11 - R Programming Basics_20250428_063125_0000.pptx
Loops and functions in r
R Language Introduction
Programming in R
Basic R Data Manipulation
Introduction to R
R basics
statistical computation using R- an intro..
Brief introduction to R Lecturenotes1_R .ppt
R_Language_study_forstudents_R_Material.ppt
Lecture1_R Programming Introduction1.ppt
R programming intro with examples
Arrays with the help of Computer Programming
Introduction2R
Modeling in R Programming Language for Beginers.ppt
Lecture1_R.ppt
Ad

More from nabati (9)

PPT
Smart manufacturing through cloud based-r-nabati--dr abdulbaghi ghaderzadeh
PPT
Ip core -iausdj.ac.ir
PPT
Contiki IoT simulation
PPT
Cloud computing standards and protocols r.nabati
PPT
Internet of things (IoT) and big data- r.nabati
PPT
Graph theory concepts complex networks presents-rouhollah nabati
PPT
Big data analytics, survey r.nabati
PPT
Random walks on graphs - link prediction by Rouhollah Nabati
PPT
Introduction to latex by Rouhollah Nabati
Smart manufacturing through cloud based-r-nabati--dr abdulbaghi ghaderzadeh
Ip core -iausdj.ac.ir
Contiki IoT simulation
Cloud computing standards and protocols r.nabati
Internet of things (IoT) and big data- r.nabati
Graph theory concepts complex networks presents-rouhollah nabati
Big data analytics, survey r.nabati
Random walks on graphs - link prediction by Rouhollah Nabati
Introduction to latex by Rouhollah Nabati

Recently uploaded (20)

PDF
AI Guide for Business Growth - Arna Softech
PDF
Internet Download Manager IDM Crack powerful download accelerator New Version...
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PPTX
Human-Computer Interaction for Lecture 2
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
Viber For Windows 25.7.1 Crack + Serial Keygen
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PPTX
Airline CRS | Airline CRS Systems | CRS System
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
What Makes a Great Data Visualization Consulting Service.pdf
PPTX
Lecture 5 Software Requirement Engineering
PPTX
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
PDF
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...
AI Guide for Business Growth - Arna Softech
Internet Download Manager IDM Crack powerful download accelerator New Version...
Download Adobe Photoshop Crack 2025 Free
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
Human-Computer Interaction for Lecture 2
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Viber For Windows 25.7.1 Crack + Serial Keygen
Full-Stack Developer Courses That Actually Land You Jobs
Airline CRS | Airline CRS Systems | CRS System
BoxLang Dynamic AWS Lambda - Japan Edition
What Makes a Great Data Visualization Consulting Service.pdf
Lecture 5 Software Requirement Engineering
Bandicam Screen Recorder 8.2.1 Build 2529 Crack
SOFTWARE ENGINEERING Software Engineering (3rd Edition) by K.K. Aggarwal & Yo...
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
HackYourBrain__UtrechtJUG__11092025.pptx
Matchmaking for JVMs: How to Pick the Perfect GC Partner
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...

Introduction to R r.nabati - iausdj.ac.ir

Editor's Notes

  • #4: You will learn later that dataframes can be imported from other statistical packages such as Excel and Spss. However, knowing the basics on how R reads dataframes will help you manipulate your own data better in this package.
  • #5: To the minimum R can be used as a calculator. The prompt sign means the active line where you are allowed to enter code. The number in brackets is the result. When you enter a line in R, you don’t need to end it with a period as opposed to other software such as the syntax in spss.
  • #6: Missing values are noise to statistical estimations. We are going to learn a basic command for handling missing values.
  • #10: Talk about useful packages included in the CD.
  • #14: In this slide. Go to R code and practice creating objects and vectors.