R Introduction [Link]
R Introduction
Overview
R is a programming language and software environment for statistical analysis, graphics representation and
reporting
Evolution of R
Creator : Ross Ihaka and Robert Gentleman
Created at : Dept of Statistics, University of Auckland, New Zealand
Year : 1993
Current team : Since mid-1997 there has been a core group (the “R Core Team”) who can modify the R
source code archive
License : free under GNU General Public License
R is free software distributed under a GNU-style copy left, and an official part of the GNU project called
GNU S.
Old Name of R : S programming
S programming language : S is a statistical programming language developed primarily by John
Chambers and Rick Becker and Allan Wilks of Bell Laboratories.
S built year : 1976
S now implemented as R
Read more on
[Link] ([Link]
/wiki/R_(programming_language))
[Link] ([Link]
/wiki/S_(programming_language))
[Link] ([Link]
Major Features
core R is interpreted language
allows use of functions , branching , looping, and input and output facilities.
allows integration with the procedures written in the C, C++, .Net, Python or FORTRAN languages for
efficiency.
has an effective data handling and storage facility,
1 of 4 18-10-2023, 02:59 pm
R Introduction [Link]
provides a suite of operators for direct calculations on arrays, lists, vectors and matrices (a.k.a.
vectorised operations).
provides a large, coherent and integrated collection of tools for data analysis
provides graphical facilities for data analysis and display either directly at the computer or printing at the
papers.
Why R ? or Why to choose R programming ?
Strengths of R programming
R has large number of packages for statistical analysis and data science
R can be used for complex statistical modelling
R Facilitates interaction with databases
For statistical minded person, R is Simple and easy to understand
Limitations of R
limited community support
R can’t be used to create a complete end to end software
Major Libraries (Packages) in R
R base
tidy verse
GGPlot2
tidyr
dplyr
knitr
caret
Installation of R
Windows Installation
Install R base
You can download the latest Windows installer version of R from [Link]
([Link]
As it is a Windows installer (.exe) with a name “[Link]”. You can just double click and run the
installer accepting the default settings. If your Windows is 32-bit version, it installs the 32-bit version. But if your
windows is 64-bit, then it installs both the 32-bit and 64-bit versions. After installation you can run it After
running you will get R console with basic GUI
Install R studio
** NOTE: Install R Studio ONLY AFTER R base is installed and running
2 of 4 18-10-2023, 02:59 pm
R Introduction [Link]
You can download R studio Desktop version from [Link] ([Link]
/products/open-source/rstudio/) and Install it.
This is a GUI tool for writing R scripts (.R) and R markmown (.Rmd) files.
R Command Prompt
Open R base (using shortcut on desktop)
It will give you command prompt to perform R operations
You can write R commands and execute them here
For example:
m = “Hello in R programing!”
print(m)
[1] “Hello in R programing!”
R Script File (.R)
Script file is collection of commands in R to run them together.
Script helps to save all the work at one place as .R file.
Comments in R Script
Single comment is written using # in the beginning of the statement
Example : # This is first comment
they are ignored by the interpreter while executing your actual script
R markdown File (.Rmd) or R notebook
This is latest type of file supported by R
R Markdown files are also known as notebook in R
It allows writing notes, explaintions along with the codes.
Markdown files have option to insert code snipets.
Output of code snipets is visible within the markdown file
Markdown file can be directly converted to HTML or PDF files
For example these notes are generated using markdown files ! :)
R Gui
3 of 4 18-10-2023, 02:59 pm
R Introduction [Link]
When you open R base (using shortcut on desktop), R gui is launched
It gives you facility - to run the commands one by one - to run complete R script - to run part of R script - to
save script - to print the script - to load/open “workspace” ( workspace is any directory in your system)
R Studio
Specialised GUI to work with R scripts and Markdown files
Gives 4 panes : Source pane, Environment Pane, Console Pane and Files Pane
Read more at : [Link] ([Link]
/courses/ryouwithme/01-basicbasics-1/)
Errors, Warnings and Messages
R reports errors, warnings, and messages in unique way.
R reports ALL a glaring red font, which makes it seem like it is scolding you.
However, seeing red text in the console is not always bad.
Errors: Errors start with message “Error in …” When error comes script will stop running and will not
complete the operation
Warnings: Wornings start with message “Worning:” In this case script will continue running and complete
the operation
Messages: When red text is not having Error / Worning , then it is message from R There is no problem
this is just a message
4 of 4 18-10-2023, 02:59 pm