In this section we will look at some simple graph commands for vectors, that are part of the base R system. For fancier graphics, check out the ggPlot package.
Here is some data, in what is known as a named vector:
A common graph for such data would be a labeled dot plot:
Another would be a bar chart:
If you are willing to use the lattice package, you can use the commands dotplot
and barchart
instead.
For non-labeled data, we would typically build histograms or boxplots. The following command generates 500 normally distributed random values and uses those as x
.
You can also use bwplot
instead of boxplot
, if you use the lattice package.