Professional Documents
Culture Documents
serial
• Consider a serialized data with 3 Sites, 3 Treatments, 4
reps and variable Y
Introduction to R: Site Trt Rep Y Site Trt Rep Y Site Trt Rep Y
Data Manipulation and Statistical A
A
1
1
1
2
3
6
B
B
1
1
1
2
3
6
C 1 1 8
C 1 2 NA
Analysis A 1 3 8 B 1 3 5 C 1 3 8
A 1 4 5 B 1 4 NA C 1 4 6
A 2 1 4 B 2 1 7 C 2 1 5
A 2 2 4 B 2 2 0
Descriptive Statistics A 2 3 6 B 2 3 8
C 2 2 4
C 2 3 4
Leilani A. Nora A 2 4 9 B 2 4 2 C 2 4 7
Assistant Scientist A 3 1 7 B 3 1 5
A 3 2 4 B 3 2 7
A 3 3 2 B 3 3 4
A 3 4 4 B 3 4 4
• quantile() computes various quantiles of data • Output are the quartiles, min, max, median, mean and
the count of NA’s.
• summary() will be discussed on the next slide
SUMMARY STATISTICS : summary() SUMMARY STATISTICS : length()
• Ex2. To obtain summary statistics for all the columns of a
data frame • Use to obtain number of data points of a variable,
> summary(data.serial) say Y
Site Trt Rep Y > length(data.serial$Y)
A:12 Min. :1.000 Min. :1.00 Min. :0.000
B:12 1st Qu.:1.000 1st Qu.:1.75 1st Qu.:4.000 [1] 32
C: 8 Median :2.000 Median :2.50 Median :5.000
Mean :1.875 Mean :2.50 Mean :5.167
3rd Qu.:2.250 3rd Qu.:3.25 3rd Qu.:7.000
Max. :3.000 Max. :4.00 Max. :9.000
NA's :2.000
$C
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
4.0 4.5 6.0 6.0 7.5 8.0 1.0
0.15
BOXPLOT
Probability
0.10
0.05
0.00
0 2 4 6 8 10
Y class
BOXPLOT :boxplot()
• Ex1. To obtain boxplot of Y with other graphics parameters
Boxplot of Y > boxplot(split
> Boxplot(data.serial$Y,
(data.serial$Y,
boxwex=0.35,
data.serial$Site))
8
main=“Boxplot of Y”,
xlab=“Y”,
6
horizontal=TRUE) > boxplot(Y~Site,
data=data.serial)
4
# boxwex = controls the width
of the boxplot
2
# horizontal = logical, if
0
TRUE, the boxplot is plotted A B C
horizontally 0 2 4 6 8
THANK YOU! ☺
Please do Exercise C