R Programming Language

Slides:



Advertisements
Similar presentations
Chubaka Producciones Presenta :.
Advertisements

2012 JANUARY Sun Mon Tue Wed Thu Fri Sat
P Pathophysiology Calendar. SundayMondayTuesdayWednesdayThursdayFridaySaturday January 2012.
What is R Muhammad Omer. What is R  R is the programing language software for statistical computing and data analysis  The R language is extensively.
What is R By: Wase Siddiqui. Introduction R is a programming language which is used for statistical computing and graphics. “R is a language and environment.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Data Visualization using R
Hands-on Introduction to R. We live in oceans of data. Computers are essential to record and help analyse it. Competent scientists speak C/C++, Java,
WORD JUMBLE. Months of the year Word in jumbled form e r r f b u y a Word in jumbled form e r r f b u y a february Click for the answer Next Question.
DATE POWER 2 INCOME JANUARY 100member X 25.00P2, FEBRUARY 200member X 25.00P5, MARCH 400member X 25.00P10, APRIL 800member.
An Introduction to R Statistical Computing AMS 597 Stony Brook University Spring 2009 By Tianyi Zhang.
2011 Calendar Important Dates/Events/Homework. SunSatFriThursWedTuesMon January
TEMPORAL VISUALIZATION OF DATA FROM THE FRENCH SENTINEL NETWORK.
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
July 2007 SundayMondayTuesdayWednesdayThursdayFridaySaturday
Pinellas County Schools
Sihua Peng, PhD Shanghai Ocean University
Chapter 7. Classification and Prediction
Programming in R Intro, data and programming structures
R programming language
Regression Analysis Module 3.
1-1 Logic and Syntax A computer program is a solution to a problem.
REGRESSION ANALYSIS Definition:
Dictation practice 2nd Form Ms. Micaela-Ms. Verónica.
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
McDonald’s Kalender 2009.
McDonald’s Kalender 2009.
Programming Right from the Start with Visual Basic .NET 1/e
1   1.テキストの入れ替え テキストを自由に入れ替えることができます。 フチなし全面印刷がおすすめです。 印刷のポイント.
JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
ANNUAL CALENDAR HOLIDAYS JANUARY FEBRUARY MARCH APRIL MAY JUNE
HOLIDAYS ANNUAL CALENDAR JANUARY FEBRUARY MARCH APRIL MAY JUNE
McDonald’s Kalender 2009.
January Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
Communication and Coding Theory Lab(CS491)
0845 Analysis I have only very recently taken over responsibility for the 0845 number and whilst questions were asked of Derrick some months ago, we have.
Problem Gambling Clicks to Opgr.org
HOLIDAYS ANNUAL CALENDAR JANUARY FEBRUARY MARCH APRIL MAY JUNE
S M T W F S M T W F
January MON TUE WED THU FRI SAT SUN
McDonald’s calendar 2007.
1 - January - Sun Mon The Wed Thu Fri Sat
2 0 X X s c h e d u l e 1 MON TUE WED THU JANUARY 20XX FRI SAT SUN MEMO.
Proud As A Peacock! We are very proud of__________________
Teacher name August phone: Enter text here.
January MON TUE WED THU FRI SAT SUN
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
Introduction to Matlab
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
MONTHS OF THE YEAR January February April March June May July August
S M T W F S M T W F
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
McDonald’s calendar 2007.
INTRODUCTION to PERL PART 1.
1 January 2018 Sun Mon Tue Wed Thu Fri Sat
1 January MON TUE WED THU FRI SAT SUN MEMO 2 February MON TUE WED THU FRI SAT SUN.
Habitat Changes and Fish Migration
2015 January February March April May June July August September
Habitat Changes and Fish Migration
S M T W F S M T W F
S M T W F S M T W F
1 January MON TUE WED THU FRI SAT SUN MEMO 2 February MON TUE WED THU FRI SAT SUN.
Presentation transcript:

R Programming Language Introduction – History, Data Types, Statistics, Uses

History Of R R is a programming language and software environment for statistical analysis, graphics representation and reporting. R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team. The core of R is an interpreted computer language which allows branching and looping as well as modular programming using functions. R allows integration with the procedures written in the C, C++, .Net, Python or FORTRAN languages for efficiency.

Hello World # My first program in R Programming myString <- "Hello, World!" print ( myString)

Data Types and Declarations Unlike C++ and Java, and similar to Matlab, Perl and PHP, R doesn’t not declare data types when using variables. The type of an object is determined at the time of initialization and is determined by the type of the assigned data. Common types are: Vectors Matrices Arrays Data Frames Lists Factors

Vector # Create a vector. routine <- c(‘gym',‘tan',“laundry") # c() is a R function that combines elements print(routine)

List # Create a list. list1 <- list(c(1,2,4)) print(list1)

Matrix # Create a matrix. M = matrix( c(‘a1','a2',‘a3',‘b1',‘b2',‘b3' ,'c1',‘c2',‘c3'), ), nrow = 3, ncol = 3, byrow = TRUE) print(M) Note: Matrix in R can only have 2 dimensions

Arrays # Create an array. a <- array(c(‘heads',‘tales'), dim = c(3,1,2)) Print(a) " , , 1 [,1] [,2] [,3] [1,] “heads" “tales" “heads" [2,] “tales" “heads" “tales" [3,] “heads" “tales" “heads" , , 2 [1,] “tales" “heads" “tales" [2,] “heads" “tales" “heads" [3,] “tales" “heads" “tales"

Data Frame # Create the data frame. stocks <- data.frame( symbol = c(“IBM", “GOOG",“T"), price = c(152, 625, 55), ask = c(153,626, 56), bid = c(151,624, 54) print(stocks) symbol price ask bid 1 IBM 153 153 151 2 GOOG 625 626 624 3 T 152 153 151

Factors # Create a vector. sentence <- c(‘me',‘casa',‘tu',‘casa') # Create a factor object. factor_sentence <- factor(sentence) # Print the factor. print(factor_sentence) print(nlevels(factor_sentence)) [1] me casa tu casa Levels: me casa tu [1] 3

Number of occurrences of words > mons = c("March","April","January","November","January", + "September","October","September","November","August", + "January","November","November","February","May","August", + "July","December","August","August","September","November", + "February","April") > mons = factor(mons) > table(mons) mons     April    August  December  February   January      July          2          4          1          2          3          1     March       May  November   October September          1          1          5          1          3

Statistics – Mean and standard deviation a <- c(50,150) mean(a) [1] 100 sd(a) [1] 70.71068

Normal Distribution What percentage of student got a grade over 84 when the grades are normally distributed with a mean of 72, and a standard deviation of 15.2? pnorm(84, mean=72, sd=15.2, lower.tail=FALSE) [1] 0.2149176

Ex) Squares and Linear Regression > x <- c(1, 2, 3, 4, 5, 6) # Create ordered collection (vector) > y <- x^2 # Square the elements of x > print(y) # print (vector) y [1] 1 4 9 16 25 36 > mean(y) # Calculate average (arithmetic mean) of (vector) y; result is scalar [1] 15.16667 > var(y) # Calculate sample variance [1] 178.9667 > lm_1 <- lm(y ~ x) # Fit a linear regression model "y = B0 + (B1 * x)" # store the results as lm_1 > print(lm_1) # Print the model from the (linear model object) lm_1 Call: lm(formula = y ~ x) Coefficients: (Intercept) x -9.333 7.000

What can you do with R effectively - Analytics - Graphics and Visualization - Applications and Extensions - Programming Language features

Analytics with R Basic Mathematics Basic Statistics Probability Distributions Big Data Analytics  Machine Learning Optimization and Mathematical Programming Signal Processing Simulation and Random Number Generation Statistical Modeling Statistical Tests

Graphics and Visualization with R Static Graphics Dynamic Graphics Devices and Formats

Applications and Extensions with R Data Mining and Machine Learning Statistical Methodology Other Distributions Available in Third-Party Packages

Programming Language features of R Input / Output Object-oriented programming Distributed Computing Included R Packages