22
Programming Language SEMINAR BY: RAHUL SINGH

R programming Language , Rahul Singh

Embed Size (px)

Citation preview

Page 1: R programming Language , Rahul Singh

Programming Language SEMINAR BY: RAHUL SINGH

Page 2: R programming Language , Rahul Singh

CONTENTSHistoryIntroductionWhy R?R PackageR GUIFeaturesGetting StartedWhy Use R?Comparison with other programming languagesMeritsDemeritsConclusion

Page 3: R programming Language , Rahul Singh

HistoryR is a programming language which was an

implementation over S language.

R was first designed by Ross Ihaka and Robert Gentleman at the University of Auckland in 1993.

It was stable released on October 31st 2014 the 4 months ago ,by R Development Core Team Under GNU General Public License.

Page 4: R programming Language , Rahul Singh

IntroductionR is functional programming

languageR is an interpreted languageR is case sensitiveR is object oriented-languageThe R language is widely used

among statisticians and data miners for developing statistical software and data analysis.

Page 5: R programming Language , Rahul Singh

Why R ?The R statistical programming

language is a free open source package.

Many statistical functions are already built in.

The most extensive modeling resources in scientific research.

The fine publishing quality graphs.R is freely available under GNU

General Public License.

Page 6: R programming Language , Rahul Singh

R Package

A Package is a collection of R functions with comprehensive documents.

A Package includes: R functions, Data Example, Help Files, Namespace and Description.

The default installation is kept as minimum.

The function of R could be extent by loading R packages.

Page 7: R programming Language , Rahul Singh

R GUI

Page 8: R programming Language , Rahul Singh

Features Open Source: The source code of R program and the extensions could

be examined line by line. Integrating with other Programming Language: R is an interpreting language, can be rather slow, but

could integrate with high e cient languages such as C, ffiC++ or Fortran.

OS Independence: UNIX, Linux, Windows, MacOS, FreeBSD... Command line Driven: You have to write Commands...

Page 9: R programming Language , Rahul Singh

Getting StartedBasic ObjectsVectorListFactorArrayMatrixData Frame

Page 10: R programming Language , Rahul Singh

Basic assignment and operations.Arithmetic Operations:

◦+, -, *, /, ^ are the standard arithmetic operators.

Matrix Arithmetic.◦* is element wise multiplication◦%*% is matrix multiplication

Assignment◦To assign a value to a variable use

“<-”

Page 11: R programming Language , Rahul Singh

Basic Functions Used In R Language

Page 12: R programming Language , Rahul Singh

LoopsWhen the same or similar tasks need to be performed multiple times; for all elements of a list; for all columns of an array; etc.

for(i in 1:10) { print(i*i)}

i<-1while(i<=10) { print(i*i) i<-i+sqrt(i)}

Page 13: R programming Language , Rahul Singh

ArrayArray

◦An extension of a vector to more than two dimensions

◦a <- array(c(1,2,3,4,5,6,7,8,9,10,11,12),dim=c(3,4))

Page 14: R programming Language , Rahul Singh

Programming features• Flow control statements

• while, repeat, break, continue, if, return

• Exceptions, using try catch blocks• Functions

o Default parameterso Positional or named argumentso Generico Anonymous

Page 15: R programming Language , Rahul Singh

Example• `%my%` <- function(a,b) { return 2*a + 2 *b } fibonacci <- function(n) { if(n<=2) return 1 fib <- numeric(n) fib[1:2] <- 1 for(i in 3:n) { fib[i] <- fib[i-1] + fib[i-2] } return (fib[n])

Page 16: R programming Language , Rahul Singh

Why use R?Matrix calculationData visualization (interactive

too)Statistic analysis (regression,

time series, geo-spatial)Data mining, classification,

clusteringAnalysis of genomic dataMachine learning

Page 17: R programming Language , Rahul Singh

Comparison with other languagesR Programming Python Java•It was stably released in 2014.

•It was stably released in 1996.

•It was stably released in 1995.

•It has more functions and packages.

•It has less functions and packages.

•It has large number of inbuilt functions and packages.

•It is an interpreter base language

•It is an interpreter base language

•It is interpreter and compiled based language.

•It is statistical design and graphics programming language.

•It is general purpose language.

•It is general purpose programming language designed for web applications .

•It is difficult to learn and understand.

•It is easy to understand.

•It is easy to learn and understand.

•R is mostly use for data analysis.

•Generic programming tasks such as design of software's or desktop applications.

•Java is mostly used in design of windows applications and web applications.

Page 18: R programming Language , Rahul Singh

MeritsR is a programming language and

environment developed for statistical analysis by practicing statisticians and researchers.

The graphical capabilities of R are outstanding, providing a fully programmable graphics language. 

R is free and open source software, allowing anyone to use and, importantly, to modify it.

Page 19: R programming Language , Rahul Singh

R has over 4800 packages available from multiple repositories specializing in topics like econometrics, data mining, spatial analysis, and bio-informatics.

R is cross-platform. R runs on many operating systems and different hardware.

Page 20: R programming Language , Rahul Singh

DemeritsR is slow : Is an interpreting language

and is not very fast. Could be 1/40 of C.

Limitation of Memory: All the objects are in memory.

R is hard to learn: One has to memorize the commands/functions, and understand the logics of programming. The fluency in R requires great time and energy.

Page 21: R programming Language , Rahul Singh

ConclusionR has become a high quality

open-source software environment for statistical computing and graphics

R allows the usage of many control flows, loops and user-defined functions, multiple input and output data formats

R continues to help shape the future of statistical analysis, and data science.

Page 22: R programming Language , Rahul Singh

Thanks..