Getting started with R
• Introduction to R
• Introduction to ‘RStudio’
• Understanding the distinction:
R vs. RStudio
• Advantages of R
• Getting started with R
• Installation of R Packages
• Installing RStudio
• Installing R Packages
Chapter outline • Importing data in RStudio
• Data Structures in R
• Vector
• Matrix
• Array
• Lists
• Factors
• Data Frames
10-12-2024 19:33:07 Dr ARUN JULKA 2
-Geoffrey Moore,
Author of crossing the chasm & inside the tornado
“Without big data analytics, companies are blind
and deaf, wandering out into the web like deer on
a freeway.”
10-12-2024 19:33:07 Dr ARUN JULKA 3
• ‘R’ is a programming language for statistical computing
and graphics.
• R is the successor language of the ‘S’ language.
• The name of this language ‘R’ has been derived from
the first alphabet of its developers’ names, viz., Robert
Gentleman and Ross Ihaka.
• R provides many graphical and statistical tools such as,
linear, and nonlinear modelling, classification, classical
statistical tests, and clustering etc.
Introduction to R • It runs on various UNIX platforms and other systems
including Windows and MacOS.
• R offers an integrated software facilities including
operators for calculations, intermediate tools for data
manipulation, data visualisation, data storage and
handling facilities.
• R is a fully developed language. It consists of various
loops, conditionals, and other output- input functions.
For this reason, it popularly known as ‘R Environment.’
10-12-2024 19:33:07 Dr ARUN JULKA 4
Introduction
to R Studio
• RStudio is an integrated
development
environment (IDE).
• It is particularly
designed to work with
the R programming
language.
• RStudio can be broadly
divided into 4 panes:
10-12-2024 19:33:07 Dr ARUN JULKA 5
R vs. RStudio
Basis R RStudio
Meaning It is a programming language. It is an Integrated Development Environment
(IDE).
Objective It aims at statistical computing and It aims at development of statistical programs.
graphics.
Elaborative R is the core engine for performing data RStudio is more elaborative in nature as it
analysis and computations. However, it is provides a more user- friendly environment
process
less elaborative than RStudio. for working with R.
Independent It is an independent platform which means It is not an independent platform which means
it can be used on any other operating it is specifically designed for R language only.
platform
system that understands the R coding.
Extension R script has an extension ‘. R’ RStudio project file has an extension ‘. Rproj’
10-12-2024 19:33:07 Dr ARUN JULKA 6
Advantages of R
Statistical Excellence
Open-source
Extensive Libraries
Cross-platform Support
Versatile data handling
Data Wrangling
10-12-2024 19:33:08 Dr ARUN JULKA 7
Advantages of R
Powerful Graphics
Highly Active Community
Parallel and Distributed Computing
Interpreter based execution
Compatible with other Programming Languages
Machine learning capabilities
Interaction with Databases
10-12-2024 19:33:08 Dr ARUN JULKA 8
Getting started with R
Installation of R
• Step 1: Go to [Link]
• Step 2: Click on “Download R for
Windows”
• Step 3: Click on “Installing R for the first
time”
• Step 4: Click on “Download R 4.2.2 for
Windows”
10-12-2024 19:33:08 Dr ARUN JULKA 9
Getting started with R
Installing RStudio
Step 1: Go to
[Link]
Step 2: Scroll down and click on
“Download” under RStudio column
Step 3: Click on Download option in
“RStudio Desktop Open-Source
License”
Step 4: Download RStudio 1.0.153 –
Windows Vista/7/8/9/10/11
10-12-2024 19:33:08 Dr ARUN JULKA 10
Getting started with R
Installing R Packages
Step 1: Open RStudio, the following screen will
appear
Method 1: Using codes in the R console, type
the following syntax:
>library(package name) and press ENTER.
For example, to install ‘dplyr’ package in R
studio go to R console and give the following
commands:
>library(dplyr) and press ENTER
10-12-2024 19:33:08 Dr ARUN JULKA 11
Getting started with R
Method 2: Using plots window
In the plots window on the lower
right-hand side, go to packages tab
and select the ‘dplyr’ package from
the list
10-12-2024 19:33:08 Dr ARUN JULKA 12
Getting started with R
Importing data in RStudio
To import data in RStudio, the following steps are
used:
Step 1: Select the ‘Environment’ tab given on the
upper right side of RStudio window
Step 2: Click on the ‘Import Dataset’ tab
Step 3: Select the option according to the file type.
Step 4: After selecting the file type, following window
will open. Click on ‘Browse’ and select the file from
the PC. Finally, click on ‘Import’ button. The data will
be imported in the RStudio.
10-12-2024 19:33:08 Dr ARUN JULKA 13
Data Structures in R
Data structures are the objects that are
used to store data in an organised manner.
In R, data structures are of following type:
• List
• Matrix
• Vector
• Data Frame
• Factors
10-12-2024 19:33:08 14
Dr ARUN JULKA
10-12-2024 19:33:08 Dr ARUN JULKA 15