June 2016
Beginner to intermediate
1783 pages
71h 22m
English
The density plot is mostly used to compare distributions of two numeric variables or a single numeric variable over the category of other variables. In this recipe, we will produce a density plot using the ggplot2 library.
To display the density, we will recall ggplotdata here and will use the disA variable to display the density plot.
To create a density plot, the basic code is as follows:
ggplot(data=ggplotdata,aes(x=disA))+geom_density()
The following figure shows us the visual output of the preceding code:

The basic command is the same with ggplot(), but the main ...
Read now
Unlock full access