2 / 25

Lecture 1: Introduction to and RStudio 3 / 27 R Basics

Comparison What is R with other technologies

History RStudio

PROGRAMMING Why Learn Applications

Companies Features using R 4 / 27 What is R Programming Language?

Provides Statistical and Graphical Techniques Provides Well Designed Quality Posts

Open Source Programming Language

WHAT IS ? R is Available Runs on Wide as a Free Software Variety of Platform 5 / 27 What is R Programming Language? R is an open-source programming language that facilitates statistical computing and graphical libraries. Being open-source, R enjoys community support of avid developers who work on releasing new packages, updating R and making it a steadfast programming package for Data Science. • With the help of R, one can perform various statistical operations. • You can obtain it for free from the website www.r-project.org. • It is driven by command lines. • Each command is executed when the user enters them into the prompt. 6 / 27 History of R

It Was created by R is the top Google Ross Ihaka & search for advanced Robert Gentleman analytics software

Its First version It is Used by more Was released than 2 million March 1995 people worldwide

It was Named after It is the Most used The first letter of PROGRAMMING LANGUAGE Data Science the founders language after SQL 7 / 27 Evaluation of R Programming • R language was developed by Ross Ihaka and Robert Gentleman in 1990. • Ross Ihaka and Robert Gentleman both worked together in the statistics department at Auckland University, New Zealand. • R showed its first appearance in the year 1993. • R language is based upon the S language. • S language was developed mainly by John Chambers in 1970 at Bell laboratories. • R software is an open source software, and it is a GNU (General Public License) based project. • R language along with the software, was developed by the group of people known as ‘R Core Team’. 8 / 27 Why Learn R Programming Language

Free and Gateway to Open-Source tool lucrative career

Large community Has a robust of users visualization library

Popular for WHY LEARN? Goes to language for academic research Stats. & Data Science

Independent Used in almost platform every industry 9 / 27 Why Learn R Programming Language

• With R, you can perform statistical analysis, data analysis as well as machine learning. We can create objects, functions and packages in it. R is platform-independent and can be used across multiple operating systems. R is free owing to its open-source GNU licensing and can be installed by anyone. • R consists of a robust and aesthetic collection of graphical libraries like , plotly and many more. With these libraries, you can make visually appealing and elegant visualizations. • R is most widely used by various industries. Only the academic avenues in the past made use of R but industries are now using R as their primary tool for statistical modeling. The most profound industry that makes use of R is the Data Science industry and the several underlying industries that it comprises of industries like health, finance, banking, manufacturing and many more. • There are about 2 million job openings for R programmers worldwide. Companies hire R programmers for many roles like data analysts, business analysts, data visualization experts, and business intelligence experts. 10 / 27 Features of R Programming

Open-Source Machine Learning Operations

Complete Language Support Extensions

Analytical Support Community Support FEATURES

Quality Plotting & Graphing Simple and Easy to Understand

Comparable and often superior in power Object-oriented and functional to commercial products in most senses programming structure 11 / 27 Features of R Programming

• R is a comprehensive programming language that provides support for procedural programming involving functions as well as object-oriented programming with generic functions. • There are more than 10,000 packages in the repository of R programming. With these packages, one can make use of functions to facilitate easier programming. • Being an interpreter-based language, R produces a machine-independent code that is portable in nature. Furthermore, it facilitates easy debugging of errors in the code. • R facilitates complex operations with vectors, arrays, data frames as well as other data objects that have varying sizes. • R provides robust facilities for data handling and storage. • R can be easily integrated with many other technologies and frameworks like Hadoop and HDFS. It can also integrate with other programming languages like C, C++, Python, Java, FORTRAN, and JavaScript.

13 / 27 Advantages and Disadvantages of R

Open Source Weak Origin Data Wrangling Data Handling Array of Packages Basic Security Quality Plotting and Graphing Complicated Language Platform Independent Slower Speed Machine Learning Operations Consuming All Available Memory Continuously Growing 14 / 27 How R is better than other Technologies 15 / 27 IDEs for R

If you use R under Windows or Mac OS X, then a graphical user interface (GUI) is available to you. This consists of a command-line interpreter, facilities for displaying plots and help pages, and a basic text editor. There are several editors and IDEs that facilitate GUI features for executing R scripts. Some of the useful editors that support the R programming language are: • Emacs + ESS • Eclipse/Architect • RStudio • Revolution-R • Live-R 16 / 27 Other IDEs and Editors

There are many more editors that you can use to write R code. Here’s a quick roundup of a few more possibilities: • JGR [pronounced “Jaguar”] is a Java-based GUI for R, essentially a souped-up version of the stock R GUI. • Tinn-R is a fork of the editor TINN that has extensions specifically to help you write R code. • SciViews-K, from the same team that makes Tinn-R, is an extension for the KomodoIDE to work with R. • Vim-R is a plug-in for Vim that provides R integration. • NppToR plugs into Notepad++ to give R integration 17 / 27 RStudio

Features of RStudio: • RStudio provides various tools and features that allow you to boost your code productivity. • It can also be accessed over the web and is cross-platform in nature. • It facilitates automatic checking of updates so that you don’t have to check for them manually. • It provides support for recovery in case of file loss. • With RStudio, you can manage the data more efficiently.

19 / 27 Components of RStudio

• Source – In the top left corner of the screen is the text editor that allows you to work within source scripting. You can enter multiple lines in this source. Furthermore, users can save the R scripts to files that are stored in local memory. • Console – This is present on the bottom left corner of the main window of R Studio. It facilitates interactive scripting in R. • Workspace and History – In the top right corner, you will find the R workspace and the history window. This will give you the list of all the variables that were created in the environment session. Furthermore, you can also view the list of past commands that were executed by R. 20 / 27 Application of R Programming 21 / 27 Application of R Programming

• R is used in finance and banking sectors for detecting fraud, reducing customer churn rate and for making future decisions. • R is also used by bioinformatics to analyze strands of genetic sequences, for performing drug discovery and also in computational neuroscience. • R is used in social media analysis to discover potential customers in online advertising. Companies also use social media information to analyze customer sentiments for making their products better. • E-Commerce companies make use of R to analyze the purchases made by the customers as well as their feedbacks. • Manufacturing companies use R to analyze customer feedback. They also use it to predict future demand to adjust their manufacturing speeds and maximize profits. 22 / 27 Companies Using R 23 / 27 How to Install R and RStudio We have to follow three basic steps in the same order to run R and RStudio on your system.

• Install R • Then, install RStudio 24 / 27 1. Install R • https://www.r-project.org/ • https://cran.r-project.org/mirrors.html • https://cran.um.ac.ir/

Download R for Windows: https://cran.um.ac.ir/bin/windows/

Download R for (Mac) OS X: https://cran.um.ac.ir/bin/macosx/

Download R for Linux: https://cran.um.ac.ir/bin/linux/ 25 / 27 2. Install RStudio • https://rstudio.com/ • https://rstudio.com/products/rstudio/#rstudio-desktop • https://rstudio.com/products/rstudio/download/ 26 / 27 Suggestion of Books to Read

2012 2013 2015 2018 2015

2019 2017 2017 2019 2019 Thank You and Good Luck Any Questions?