June 2017
Beginner to intermediate
576 pages
15h 22m
English
For the following simulation section, we will need to supply the column means via a vector, so let's calculate them now and display them as a horizontal barchart. We will calculate the column means first for the diabetes positive group and then for the diabetes negative group. Finally, we will calculate the means for the total, although we will not use them in the next section:
means.pos = colMeans(PimaIndians[PimaIndians$diabetes =='pos',1:8],na.rm=TRUE) means.neg = colMeans(PimaIndians[PimaIndians$diabetes =='neg',1:8],na.rm=TRUE) means.all = colMeans(PimaIndians[,1:8],na.rm=TRUE) barplot(means.all[c(1,2,3,4,5,6,7,8)],cex.axis=.75,cex.names=.70,horiz=TRUE,space=0)
The barplot below shows the calculated means ...