Professional Documents
Culture Documents
52 R Notebook (Lab Assignment 1)
52 R Notebook (Lab Assignment 1)
52 R Notebook (Lab Assignment 1)
summary(df)
## [1] 10
## [1] 6
## [1] 2
## [1] 10
What percentage of people have red hair and Blue eyes?
nrow(df[df$Hair.Color == "Red" & df$Eye.Color == "Blue", ]) * 100 / nrow(df)
## [1] 5
Q2
df1<read.csv("D:/VIT/SY/DS/LAB/
## 3 Uncovered 1 27
germination.csv")
## 4 Uncovered 1 23
head(df1)
## 5 Uncovered 2 41
#### 6 Uncovered 2
Box water_amt 46
## 1 Uncovered122
germinated
##summary(df1)
2 Uncovered125
## Box water_amt germinated
## Length:48 Min. :1.0 Min. : 0.00
## Class :character 1st Qu.:2.0 1st Qu.:30.00
## Mode :character Median :3.5 Median :48.50
## Mean :3.5 Mean :47.62
## 3rd Qu.:5.0 3rd Qu.:73.00
## Max. :6.0 Max. :84.00
What is the average number of seeds germinated for the uncovered boxes with level of
watering equal to 4?
mean(subset(df1$germinated,df1$Box=="Uncovered" & df1$water_amt==4))
## [1] 78
## [1] 45
Establish conclusions on the o available data: a. Association of levels of watering with the
number of germinating seeds in case Of covered boxes as well as uncovered boxes.
mean(subset(df1$germinated,df1$Box=="Covered" & df1$water_amt==1))
## [1] 42.75
## [1] 75.25
## [1] 76
## [1] 52
mean(subset(df1$germinated,df1$Box=="Covered" & df1$water_amt==5))
## [1] 37.75
## [1] 0
Germination is increasing from water level 1-3 and decreasing 3-5 and it is 0 at water level
6
mean(subset(df1$germinated,df1$Box=="Uncovered" & df1$water_amt==1))
## [1] 24.25
## [1] 46
## [1] 66.75
## [1] 78
## [1] 72.75
## [1] 0
Germination is increasing from water level 1-4 and decreases at water level 5 and it is 0 at
water level 6
b)Association of number of germinating seeds with the fact that the boxes were covered or
uncovered.
mean(subset(df1$germinated,df1$Box=="Covered"))
## [1] 47.29167
mean(subset(df1$germinated,df1$Box=="Uncovered"))
## [1] 47.95833