Download presentation

Presentation is loading. Please wait.

Published byDylon Whitehead Modified over 3 years ago

1
R Language

2
What is R? Variables in R Summary of data Box plot Histogram Using Help in R

3
What is R ? R is a free, cross-platform, open-source statistical analysis language and program. Many statistical functions are already built in

4
Variables Numeric > a = 49 > sqrt(a) [1] 7 String > a = "The dog ate my homework" > sub("dog","cat",a) [1] "The cat ate my homework“ Logical > a = (1+1==3) > a [1] FALSE

5
vector: an ordered collection of data of the same type > a = c(1,2,3) To examine the contents of the variable a >a [1] 1 2 3 > a*2 [1] 2 4 6 > a[2] [1] 2

6
list: an ordered collection of data of arbitrary types. > d = list(name="john",age=28,married=F) > d$name [1] "john“ > d$age [1] 28

7
Mean Dataset: > x=c(0,4,15, 1, 6, 3, 20, 5, 8, 1, 3) >y= 1:6 >y [1] 1 2 3 4 5 6 The Mean > mean(x) [1] 6 OR > sum(x)/length(x) [1] 6

8
Median Sort the dataset if it is not sorted >sort(x) [1] 0 1 1 3 3 4 5 6 8 15 20 The Median > median(x) [1] 4 > median(y) [1] 3.5

9
Quantiles Q1 > quantile(x,0.25) 25% 2 Q3 > quantile(x,0.75) 75% 7 Quantiles > quantile(x,c(0,0.25,0.5,0.75,1)) 0% 25% 50% 75% 100% 0 2 4 7 20

10
Five Number Summary > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 0 2 4 6 7 20

11
The Spread of the Data Set Range > range(x) [1] 0 20 IQR > IQR(x) [1] 5

12
Boxplot Standard Boxplot > boxplot(x,range=0) Modified Boxplot > boxplot(x)

13
Histogram > hist(x) Adding a title > hist(x,main=“ Weight Gain ”) Adding Axis labels >hist(x, main=“Weight Gain”,xlab=“Weight Gain”, ylab =“Frequency”) Change the color >hist(x, main=“Weight Gain”,xlab=“Weight Gain”, ylab =“Frequency”, col=“blue”)

14
Read CSV > mydata=read.csv("dataset.csv") > mydata Age Income 1 10 0 2 25 35000 3 43 75000 4 32 55000 5 70 25000 6 19 20000 7 5 0 8 21 20000 9 35 60000 10 24 30000

15
How to use help in R? R has a very good help system built in. If you know which function you want help with simply use ?_______ with the function in the blank. Ex: ?hist. If you don’t know which function to use, then use help.search(“_______”). Ex: help.search(“histogram”).

16
Activity 1.Using R language, Answer question 4 from the Tutorial. 2.Export the resulted graphs.

Similar presentations

Presentation is loading. Please wait....

OK

Describing Distributions With Numbers

Describing Distributions With Numbers

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on save environment Ppt on french revolution free download Ppt on peak load pricing lecture Ppt on dressing etiquettes meaning Ppt on object-oriented concepts in java with examples Ppt on mars planet Ppt on water pollution in hindi Download ppt on data handling class 8 Ppt on regional transport office chennai Ppt on eid