Graphics Reference
In-Depth Information
library(gcookbook)
# For the data set
simpledat
A1 A2 A3
B1
10 7 12
B2
9 11 6
This will make a simple grouped bar graph, with the As going along the x-axis and the bars
grouped by the Bs (
Figure A-1
)
:
barplot(simpledat, beside
=
TRUE
TRUE
)
Figure A-1. A bar graph made with barplot()
One thing we might want to do is switch things up so the Bs go along the x-axis and the As are
used for grouping. To do this, we need to restructure the data by transposing the matrix:
t(simpledat)