5.1 Find the diamonds in the data - Video Tutorials & Practice Problems
Video duration:
1m
Play a video:
<v Voiceover>A very important</v> part of statistical analysis, whether in the exploratory phase, or when presenting the results to someone, is visualization. Not only important, but it's hard to do right. Fortunately, R offers many facilities for making beautiful graphics, both built into R and ggplot2. Before we start plotting, we need some good data to plot. A particularly good data set is included in the ggplot2 package. So let's load up that package and get the data. You require(ggplot2), load it up, and then we load the data with the data command, data(diamonds), and now we can look at it by using head of diamonds, and we see, there are a number of variables. A carat is the size of the diamond, the cut takes on many levels, whether that is ideal or premium, good, very good. Color can take on values such E, I, and J. Then you have other variables such as clarity, depth, table, and very importantly, price. This is the data set we will primarily be working with for visualizations.