12.1TitanicDF-as.data.frame(Titanic)TitanicList-lapply(TitanicDF[1:4],rep,TitanicDF$Freq)TitanicSets-data.frame(passenger=TitanicList$Class!=Crew,adult=TitanicList$Age==Adult,male=TitanicList$Sex==Male,survivor=TitanicList$Survived==Yes)head(TitanicSets)library(gplots)library(venneuler)venn(TitanicSets[1:2])par(mar=rep(2,4))plot(venneuler(TitanicSets[1:2]),col=hcl(0,0,c(60,80),.5),alpha=NA,border=black)venn(TitanicSets[1:3])par(mar=rep(2,4))plot(venneuler(TitanicSets[1:3]),col=hcl(0,0,seq(40,80,20),.5),alpha=NA,border=black)pdf(Figures/special-venn-3-%d.pdf,onefile=FALSE,width=6,height=6)venn(TitanicSets)dev.off()png(Figures/special-venn-3-%d.png,width=240,height=240,pointsize=8)venn(TitanicSets)dev.off()par(mar=rep(2,4))plot(venneuler(TitanicSets[1:4]),col=hcl(0,0,seq(20,80,20),.5),alpha=NA,border=black)12.2library(TeachingDemos)library(symbols)faces(USJudgeRatings[1:5,],nrow=1,ncol=5)faces2(USJudgeRatings[1:5,],nrows=1,ncols=5,scale=all)symbol(USJudgeRatings[1:25,],type=face)12.3library(agricolae)data(soil,envir=environment())place2region-as.data.frame(rbind(c(Cnt1,Lima),c(Cnt2,Lima),c(Cnt3,Lima),c(Chz,Ancash),c(Chmar,Huanuco),c(Hco1,Huanuco),c(Hco2,Huanuco),c(Hco3,Huanuco),c(Hyo1,Junin),c(Hyo2,Junin),c(Namora,Cajamarca),c(SR1,Junin),c(SR2,Junin)))soils-merge(soil,place2region,by.x=place,by.y=V1)[c(sand,slime,clay)]names(soils)-c(sand,silt,clay)library(vcd)library(plotrix)library(compositions)library(soiltexture)ternaryplot(soils,col=black,grid_color=black,labels_color=black)triax.plot(soils,cex.ticks=.5)par(mar=rep(1,4))plot(rcomp(soils))lines(rcomp(rbind(c(.4,0,.6),c(0,.4,.6))))lines(rcomp(rbind(c(.65,0,.35),c(0,.65,.35))))TTsoils-soilsnames(TTsoils)-c(SAND,SILT,CLAY)TT.plot(tri.data=TTsoils)12.4hourSpeed-aggregate(hourlySpeed[Speed],list(hour=hourlySpeed$hour),mean)head(hourSpeed)library(plotrix)library(openair)trellis.par.set(theme=canonical.theme(postscript,color=FALSE))print(with(wind9am,polarFreq(data.frame(ws=Speed,wd=Dir,date=Date),cols=gray(10:1/11),border.col=black)))polar.plot(hourSpeed$Speed,hourSpeed$hour*15,start=90,clockwise=TRUE,lwd=5,label.pos=seq(15,360,15),labels=1:24,radial.lim=c(0,4.5))12.5library(circular)station22254dir-with(wind9am,Dir[Station==22254])station22254-circular(station22254dir,units=degrees,zero=pi/2,rotation=clock)windHours-circular(hourlySpeed$hour,units=hours,zero=pi/2,rotation=clock)par(mar=rep(2,4),xpd=NA)plot(station22254,stack=TRUE,sep=.06)par(mar=rep(2,4),xpd=NA)plot(density(station22254,bw=45),main=,xlab=,ylab=)par(mar=rep(1,4),xpd=NA)rose.diag(station22254,bins=36,prop=3)par(mar=rep(1,4),xpd=NA)plot(windHours,col=NA,shrink=1.2,axes=FALSE)lines(windHours,0.5*hourlySpeed$Speed/max(hourlySpeed$Speed),nosort=TRUE,lty=dotted,join=FALSE)axis.circular(template=clock24)12.6library(openair)print(with(wind9am,windRose(data.frame(ws=Speed,wd=Dir,date=Date,station=factor(Station)),paddle=FALSE,type=station,width=2)))12.7library(hexbin)data(NHANES,envir=environment())plot(Serum.Iron~Transferin,NHANES)trellis.par.set(theme=canonical.theme(postscript,color=FALSE))print(hexbinplot(Serum.Iron~Transferin,NHANES))trellis.par.set(theme=canonical.theme(postscript,color=FALSE))print(hexbinplot(Serum.Iron~Transferin|Sex,NHANES))