SlideShare a Scribd company logo
R Programming
Sakthi Dasan Sekar
http://shakthydoss.com 1
Introduction to R
R is a programming language developed as an alternative for S
language at AT&T Bell Laboratories by Robert Gentleman and Ross
Ihaka.
Due to its underlying philosophy and design R is incredibly excel in
statistical computation and graphic visualization.
R is free, open source with a very high activity community members.
Available cross all platforms (Linux, Mac, Windows)
http://shakthydoss.com 2
Introduction to R
R is much more than just its core language. It has a worldwide
repository system, the Comprehensive R Archive Network (CRAN)
http://cran.r-project.org
As of 2011, there were more than 3,000 such packages hosted on CRAN
and numerous more on other sites
http://shakthydoss.com 3
Introduction to R
Cons of R Language
R has a steep learning curve.
Working with large datasets is limited by RAM size.
http://shakthydoss.com 4
Introduction to R
Who use R in their business
http://shakthydoss.com 5
Introduction to R
Understanding of R language
• R Statement or Commands can be separated by a semicolon (;) or a newline.
• Assignment operator in R is "<-" (although "=" also works).
• All characters after # are treated as comments.
• There is not multi line or block level Comments.
• $ (dollar) operator in R is an analogous to .(dot) operator in other languages.
Student$name
Student$age
http://shakthydoss.com 6
Introduction to R
Installing R
Installing from CRAN (Comprehensive R Network)
Website: http://cran.r-project.org/
R is actively being improved all the time, Make sure that you choose
recent version to install.
http://shakthydoss.com 7
Introduction to R
Installing R in windows
For Windows and Mac OS X, one can simply download a self-installing binary.
For Linux, installation varies.
For the Debian distribution (including Ubuntu), R system can be installed using the regular
package-management tools.
Since R is open source, one can also compile and install it using the source code.
http://shakthydoss.com 8
Introduction to R
Installing R in windows
Window R package can be downloaded from
https://cran.r-project.org/bin/windows/base/
Download R 3.X.X for Windows executable file (.exe)
http://shakthydoss.com 9
Introduction to R
Click Next in the Setup Wizard.
You can leave to setting to default.
http://shakthydoss.com 10
Introduction to R
Open R Console (Rgui from your desktop) R Console
http://shakthydoss.com 11
Introduction to R
IDE for R
The RStudio project currently provides most of the desired features for
an IDE in a novel way, making it easier and more productive to use R.
The RStudio program can be run on the desktop or through a web
browser.
The desktop version is available for Windows, Mac OS X, and Linux
platforms.
http://shakthydoss.com 12
Introduction to R
Notable IDEs for R
Name Platforms
ESS Windows, Mac, Linux
Eclipse Windows, Mac, Linux
SciViews Windows, Mac, Linux
JGR Windows, Mac, Linux
Tinn-R Windows
Notepad++ Windows
Rgui Windows
http://shakthydoss.com 13
Introduction to R
Installing RStudio is usually a straightforward process.
For Windows and Mac OS X, one can simply download a self-installing binary.
For Linux, installation varies.
For the Debian distribution (including Ubuntu), RStudio can be installed using
the regular package-management tools.
http://shakthydoss.com 14
Introduction to R
Installing RStudio in windows.
https://www.rstudio.com/products/rstudio/download/
Download Rstudio.
Run the installation file.
http://shakthydoss.com 15
Introduction to R
Open RStudio
Source Panel
R console
Environment
Panel
File/Package
Panel
http://shakthydoss.com 16
Introduction to R
R workspace
When R is started, it follows this process
R is started in the working directory (aka workspace).
If present, the .Rprofile file’s commands are executed.
If present, the .Rdata file is loaded.
http://shakthydoss.com 17
Introduction to R
R workspace
R stores user-defined objects in workspace.
At the end of an R session, the user can save an snapshot of the current
workspace and reloaded automatically next time when R is started.
getwd() - return working directory
setwd() - set working directory
http://shakthydoss.com 18
Introduction to R
In RStudio you can set the workspace by Tools -> Global Options
http://shakthydoss.com 19
Introduction to R
• There are over 1,000 functions at the core of R, and new R functions are created all of the time.
• Each R function comes with its own help page, which you can access by typing the function’s name after
question mark
Getting Help
help.start() # Load HTML help pages into browser
help(package) # List help page for "package"
?package # Shortform for "help(package)"
help.search("keyword") # Search help pages for "keyword"
?help # For more options
help(package=base) # List tasks in package "base"
http://shakthydoss.com 20
Introduction to R
Packages
• Many Data Scientist programmers and statisticians , use R to design tools that can help people analyze data. Many of these
people contribute their code as preassembled collections of functions and objects called packages.
• Each R package is hosted at http://cran.r-project.org
• Not all packages are loaded by default, but can be load / install on demand
library() # List available packages to load
library("package") # loads the package
library(help="package") # list package contents
detach("package:pkg") # Unload the loaded package "pkg"
install.packages(“package") # Install the package
http://shakthydoss.com 21
Introduction to R
Installing package by GUI RStudio -> Tools -> Install Packages
Check the package to load
http://shakthydoss.com 22
Introduction to R
Knowledge Check
http://shakthydoss.com 23
Introduction to R
Which of the statement is TRUE.
A. R is a propitiatory general purpose language
B. R excels in statically computation and graphic capabilities.
C. R syntax are very similar to assembly language.
D. R has no GUI
Answer B
http://shakthydoss.com 24
Introduction to R
Which of the statement is TRUE.
A. Working with large datasets is limited by RAM size.
B. R language is own by AT&T Bell Labs
C. R available only for Unix platfroms
D. R language is design for parallel programming and horizontally scalable systems.
Answer A
http://shakthydoss.com 25
Introduction to R
What is CRAN stands for
A. Comprehensive R Network
B. Computational R Network
C. Comprehensive R Archive Network
D. Computational R Archive Network
Answer C
http://shakthydoss.com 26
Introduction to R
Which not an IDE for R language
A. RStudio
B. RGUI
C. Tinn-R
D. Dreamweaver
Answer D
http://shakthydoss.com 27
Introduction to R
When R is started.
A. It loads .Rprofile and .Rdata from workspace
B. It attempts loads only .Rdata from workspace
C. It attempts loads only .Rprofile from workspace
D. Does nothing
Answer A
http://shakthydoss.com 28
Introduction to R
Function getwd() - return working directory
A. TRUE
B. FALSE
Answer A
http://shakthydoss.com 29
Introduction to R
Function setwd() - set working directory
A. TRUE
B. FALSE
Answer A
http://shakthydoss.com 30
Introduction to R
How to browser for all help documents in R
A. help.start()
B. help(help)
C. library()
D. install.packages(help)
Answer A
http://shakthydoss.com 31
Introduction to R
How to install new packages in R.
A. Install(“package”)
B. library(“package”)
C. install.packages("package")
D. load(“package”)
Answer C
http://shakthydoss.com 32
Introduction to R
How to load a installed package.
A. load("package")
B. library("package")
C. install.packages("package")
D. library()
Answer B
http://shakthydoss.com 33

More Related Content

PDF
5 R Tutorial Data Visualization
PDF
Latih tubi pecahan tahun 4
PDF
Probability Distributions
PPT
Introduction to Scratch Programming
PPTX
register
PPTX
Latex workshop
PPTX
R programming
PPT
5 R Tutorial Data Visualization
Latih tubi pecahan tahun 4
Probability Distributions
Introduction to Scratch Programming
register
Latex workshop
R programming

What's hot (20)

PDF
2 R Tutorial Programming
PDF
Introduction to Rstudio
ODP
Introduction to Perl - Day 2
PPTX
C programming language
PPTX
Optimizing Alert Monitoring with Oracle Enterprise Manager
PDF
R code for data manipulation
PDF
Understanding oracle rac internals part 2 - slides
PPTX
PDF
Oracle Enterprise Manager Cloud Control 13c for DBAs
ODP
PRESENTACIÓN SQL
PPT
Oracle Sql Tuning
PPTX
R Programming
PPT
Data Match Merging in SAS
PDF
Backup and recovery in oracle
PDF
Sas cheat
PDF
Graph Databases - RedisGraph and RedisInsight
PPTX
Introduction to Pig
PDF
Database Security Threats - MariaDB Security Best Practices
PPTX
Machine learning ( Part 2 )
PPTX
Oracle database performance tuning
2 R Tutorial Programming
Introduction to Rstudio
Introduction to Perl - Day 2
C programming language
Optimizing Alert Monitoring with Oracle Enterprise Manager
R code for data manipulation
Understanding oracle rac internals part 2 - slides
Oracle Enterprise Manager Cloud Control 13c for DBAs
PRESENTACIÓN SQL
Oracle Sql Tuning
R Programming
Data Match Merging in SAS
Backup and recovery in oracle
Sas cheat
Graph Databases - RedisGraph and RedisInsight
Introduction to Pig
Database Security Threats - MariaDB Security Best Practices
Machine learning ( Part 2 )
Oracle database performance tuning
Ad

Viewers also liked (20)

PDF
R tutorial
PPTX
R language tutorial
PDF
R programming Basic & Advanced
PDF
Seefeld stats r_bio
PDF
Using r
PDF
R presentation
PPT
Rtutorial
PPTX
R Introduction
PDF
Introduction to R
PDF
Bayesian models in r
KEY
Presentation R basic teaching module
PPTX
Data Science Academy Student Demo day--Divyanka Sharma, Businesses in nyc
PDF
Introduction to the R Statistical Computing Environment
PDF
Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...
PPTX
R- Introduction
PPTX
Minitab 17
PPTX
Why R? A Brief Introduction to the Open Source Statistics Platform
PPT
Non Parametric Tests
PDF
Introduction to R Programming
R tutorial
R language tutorial
R programming Basic & Advanced
Seefeld stats r_bio
Using r
R presentation
Rtutorial
R Introduction
Introduction to R
Bayesian models in r
Presentation R basic teaching module
Data Science Academy Student Demo day--Divyanka Sharma, Businesses in nyc
Introduction to the R Statistical Computing Environment
Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...
R- Introduction
Minitab 17
Why R? A Brief Introduction to the Open Source Statistics Platform
Non Parametric Tests
Introduction to R Programming
Ad

Similar to 1 R Tutorial Introduction (20)

PDF
Introduction to R and R Studio
PPTX
R presentation
PDF
Introducing Revolution R Open: Enhanced, Open Source R distribution from Revo...
DOC
Rapid miner r extension 5
PPTX
R as supporting tool for analytics and simulation
PPTX
BUSINESS ANALYTICS WITH R SOFTWARE DIAST
PPTX
Introduction to statistical software R
PPTX
R Brownbag Seminar 2.1
PDF
A Handbook Of Statistical Analyses Using R
PPTX
R_L1-Aug-2022.pptx
PPTX
Introduction to R and Installation.pptx
PPTX
R language
PPTX
Garishma xcs
DOCX
R Studio (Report)
DOCX
RStudio
PPTX
Introduction to R Programming
PDF
R ext world/ useR! Kiev
PPTX
R programming
PPTX
R programming presentation
PDF
R development
Introduction to R and R Studio
R presentation
Introducing Revolution R Open: Enhanced, Open Source R distribution from Revo...
Rapid miner r extension 5
R as supporting tool for analytics and simulation
BUSINESS ANALYTICS WITH R SOFTWARE DIAST
Introduction to statistical software R
R Brownbag Seminar 2.1
A Handbook Of Statistical Analyses Using R
R_L1-Aug-2022.pptx
Introduction to R and Installation.pptx
R language
Garishma xcs
R Studio (Report)
RStudio
Introduction to R Programming
R ext world/ useR! Kiev
R programming
R programming presentation
R development

Recently uploaded (20)

PPTX
IB Computer Science - Internal Assessment.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Introduction to Knowledge Engineering Part 1
PDF
[EN] Industrial Machine Downtime Prediction
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
Leprosy and NLEP programme community medicine
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
PDF
Introduction to Data Science and Data Analysis
PDF
Lecture1 pattern recognition............
IB Computer Science - Internal Assessment.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
climate analysis of Dhaka ,Banglades.pptx
STUDY DESIGN details- Lt Col Maksud (21).pptx
Introduction to Knowledge Engineering Part 1
[EN] Industrial Machine Downtime Prediction
Reliability_Chapter_ presentation 1221.5784
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
Qualitative Qantitative and Mixed Methods.pptx
Optimise Shopper Experiences with a Strong Data Estate.pdf
Data_Analytics_and_PowerBI_Presentation.pptx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Clinical guidelines as a resource for EBP(1).pdf
Acceptance and paychological effects of mandatory extra coach I classes.pptx
Leprosy and NLEP programme community medicine
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
Introduction to Data Science and Data Analysis
Lecture1 pattern recognition............

1 R Tutorial Introduction

  • 1. R Programming Sakthi Dasan Sekar http://shakthydoss.com 1
  • 2. Introduction to R R is a programming language developed as an alternative for S language at AT&T Bell Laboratories by Robert Gentleman and Ross Ihaka. Due to its underlying philosophy and design R is incredibly excel in statistical computation and graphic visualization. R is free, open source with a very high activity community members. Available cross all platforms (Linux, Mac, Windows) http://shakthydoss.com 2
  • 3. Introduction to R R is much more than just its core language. It has a worldwide repository system, the Comprehensive R Archive Network (CRAN) http://cran.r-project.org As of 2011, there were more than 3,000 such packages hosted on CRAN and numerous more on other sites http://shakthydoss.com 3
  • 4. Introduction to R Cons of R Language R has a steep learning curve. Working with large datasets is limited by RAM size. http://shakthydoss.com 4
  • 5. Introduction to R Who use R in their business http://shakthydoss.com 5
  • 6. Introduction to R Understanding of R language • R Statement or Commands can be separated by a semicolon (;) or a newline. • Assignment operator in R is "<-" (although "=" also works). • All characters after # are treated as comments. • There is not multi line or block level Comments. • $ (dollar) operator in R is an analogous to .(dot) operator in other languages. Student$name Student$age http://shakthydoss.com 6
  • 7. Introduction to R Installing R Installing from CRAN (Comprehensive R Network) Website: http://cran.r-project.org/ R is actively being improved all the time, Make sure that you choose recent version to install. http://shakthydoss.com 7
  • 8. Introduction to R Installing R in windows For Windows and Mac OS X, one can simply download a self-installing binary. For Linux, installation varies. For the Debian distribution (including Ubuntu), R system can be installed using the regular package-management tools. Since R is open source, one can also compile and install it using the source code. http://shakthydoss.com 8
  • 9. Introduction to R Installing R in windows Window R package can be downloaded from https://cran.r-project.org/bin/windows/base/ Download R 3.X.X for Windows executable file (.exe) http://shakthydoss.com 9
  • 10. Introduction to R Click Next in the Setup Wizard. You can leave to setting to default. http://shakthydoss.com 10
  • 11. Introduction to R Open R Console (Rgui from your desktop) R Console http://shakthydoss.com 11
  • 12. Introduction to R IDE for R The RStudio project currently provides most of the desired features for an IDE in a novel way, making it easier and more productive to use R. The RStudio program can be run on the desktop or through a web browser. The desktop version is available for Windows, Mac OS X, and Linux platforms. http://shakthydoss.com 12
  • 13. Introduction to R Notable IDEs for R Name Platforms ESS Windows, Mac, Linux Eclipse Windows, Mac, Linux SciViews Windows, Mac, Linux JGR Windows, Mac, Linux Tinn-R Windows Notepad++ Windows Rgui Windows http://shakthydoss.com 13
  • 14. Introduction to R Installing RStudio is usually a straightforward process. For Windows and Mac OS X, one can simply download a self-installing binary. For Linux, installation varies. For the Debian distribution (including Ubuntu), RStudio can be installed using the regular package-management tools. http://shakthydoss.com 14
  • 15. Introduction to R Installing RStudio in windows. https://www.rstudio.com/products/rstudio/download/ Download Rstudio. Run the installation file. http://shakthydoss.com 15
  • 16. Introduction to R Open RStudio Source Panel R console Environment Panel File/Package Panel http://shakthydoss.com 16
  • 17. Introduction to R R workspace When R is started, it follows this process R is started in the working directory (aka workspace). If present, the .Rprofile file’s commands are executed. If present, the .Rdata file is loaded. http://shakthydoss.com 17
  • 18. Introduction to R R workspace R stores user-defined objects in workspace. At the end of an R session, the user can save an snapshot of the current workspace and reloaded automatically next time when R is started. getwd() - return working directory setwd() - set working directory http://shakthydoss.com 18
  • 19. Introduction to R In RStudio you can set the workspace by Tools -> Global Options http://shakthydoss.com 19
  • 20. Introduction to R • There are over 1,000 functions at the core of R, and new R functions are created all of the time. • Each R function comes with its own help page, which you can access by typing the function’s name after question mark Getting Help help.start() # Load HTML help pages into browser help(package) # List help page for "package" ?package # Shortform for "help(package)" help.search("keyword") # Search help pages for "keyword" ?help # For more options help(package=base) # List tasks in package "base" http://shakthydoss.com 20
  • 21. Introduction to R Packages • Many Data Scientist programmers and statisticians , use R to design tools that can help people analyze data. Many of these people contribute their code as preassembled collections of functions and objects called packages. • Each R package is hosted at http://cran.r-project.org • Not all packages are loaded by default, but can be load / install on demand library() # List available packages to load library("package") # loads the package library(help="package") # list package contents detach("package:pkg") # Unload the loaded package "pkg" install.packages(“package") # Install the package http://shakthydoss.com 21
  • 22. Introduction to R Installing package by GUI RStudio -> Tools -> Install Packages Check the package to load http://shakthydoss.com 22
  • 23. Introduction to R Knowledge Check http://shakthydoss.com 23
  • 24. Introduction to R Which of the statement is TRUE. A. R is a propitiatory general purpose language B. R excels in statically computation and graphic capabilities. C. R syntax are very similar to assembly language. D. R has no GUI Answer B http://shakthydoss.com 24
  • 25. Introduction to R Which of the statement is TRUE. A. Working with large datasets is limited by RAM size. B. R language is own by AT&T Bell Labs C. R available only for Unix platfroms D. R language is design for parallel programming and horizontally scalable systems. Answer A http://shakthydoss.com 25
  • 26. Introduction to R What is CRAN stands for A. Comprehensive R Network B. Computational R Network C. Comprehensive R Archive Network D. Computational R Archive Network Answer C http://shakthydoss.com 26
  • 27. Introduction to R Which not an IDE for R language A. RStudio B. RGUI C. Tinn-R D. Dreamweaver Answer D http://shakthydoss.com 27
  • 28. Introduction to R When R is started. A. It loads .Rprofile and .Rdata from workspace B. It attempts loads only .Rdata from workspace C. It attempts loads only .Rprofile from workspace D. Does nothing Answer A http://shakthydoss.com 28
  • 29. Introduction to R Function getwd() - return working directory A. TRUE B. FALSE Answer A http://shakthydoss.com 29
  • 30. Introduction to R Function setwd() - set working directory A. TRUE B. FALSE Answer A http://shakthydoss.com 30
  • 31. Introduction to R How to browser for all help documents in R A. help.start() B. help(help) C. library() D. install.packages(help) Answer A http://shakthydoss.com 31
  • 32. Introduction to R How to install new packages in R. A. Install(“package”) B. library(“package”) C. install.packages("package") D. load(“package”) Answer C http://shakthydoss.com 32
  • 33. Introduction to R How to load a installed package. A. load("package") B. library("package") C. install.packages("package") D. library() Answer B http://shakthydoss.com 33