# 030 SUMMARY & DISPLAY OF DATA #LOAD DATA: Iris=read.table("iris.txt") Iris=iris #DESCRIPTIVE STATISTICS: summary(Iris) I=Iris[,1:4] I quantile(I$Sepal.Length,probs=seq(0,1,0.1)) variances=diag(var(I)) variances sd=sqrt(variances) sd coefvar=sd/colMeans(I) coefvar #SCATTER PLOTS: plot(Iris) plot(Iris$Sepal.Length,Iris$Sepal.Width,col='red',pch=19) plot(Iris$Sepal.Length,Iris$Sepal.Width,pch=19) points(Iris$Sepal.Length[Iris$Species=='setosa'],Iris$Sepal.Width[Iris$Species=='setosa'],col='red',pch=19) points(Iris$Sepal.Length[Iris$Species=='versicolor'],Iris$Sepal.Width[Iris$Species=='versicolor'],col='blue',pch=19) #BOX PLOTS: plot(Iris$Species,Iris$Sepal.Length) library(lattice) boxplot(Iris) #HISTOGRAMS: op=par(mfrow=c(2, 2)) hist(Iris$Sepal.Length,col='red') hist(Iris$Sepal.Width,col='blue') hist(Iris$Petal.Length,col='green') hist(Iris$Petal.Width,col='purple') par(op) histogram(~ Sepal.Length | Species,data=Iris) histogram(~ Sepal.Width | Species,data=Iris) histogram(~ Petal.Length | Species,data=Iris) histogram(~ Petal.Width | Species,data=Iris)