people<-read.delim2("clipboard") pdf("boxplot1.pdf", width = 4.5, height = 4) boxplot(height~sex, data=people) dev.off() # pdf("boxplot1.pdf", width = 4.5, height = 4) svg("boxplot1.svg", width = 4.5, height = 4) boxplot(height~sex, data=people) dev.off() # Task 1 mean(people$height) var(people$height) tapply(people$height, list(people$eye.color, people$sex), mean) # F M # blue 173.5000 180.3333 # brown 175.8571 185.9167 mean.height<-aggregate(people$height, list(people$eye.color, people$sex), mean) # Group.1 Group.2 x # 1 blue F 173.5000 # 2 brown F 175.8571 # 3 blue M 180.3333 # 4 brown M 185.9167 names(mean.height)<-c("eye.color", "sex", "m.height") # Task 2 ?rnorm plants<-rnorm(10, mean=25.5, sd=2.4) plants<-rnorm(10, 25.5, 2.4) mean(plants) sd(plants) plants.2<-plants plants.2[3]<-plants.2[3]*10 mean(plants.2) sd(plants.2) plants<-rnorm(100, 25.5, 2.4) mean(plants) sd(plants) plants.2<-plants plants.2[3]<-plants.2[3]*10 mean(plants.2) sd(plants.2) # Task 3 pnorm(2.5, mean=2.1, sd=sqrt(0.9), lower.tail = F)