Often there is information to be found in the way cases differ one from the other.
A distribution is a representation of the patterns of spread of the cases.
Order: help the eye
No discrete levels. The fundamental display is density
Show some densities.
x = The first variable: always!y = The count or density or another variablegroup = or fill = or color = Still another variableOne or two more categorical variables
facet_wrap( ~ var)facet_grid(var1 ~ var2)interval —- ordered —– categorical
The different levels of the variable have a natural order; it’s natural to say that one level is higher than another or that a level is in-between two other levels.
For variables with a natural order, does the interval between levels have a specific meaning?
NHANES package has the NHANES data table
Gender: no order (therefore not interval)Education: ordered but not intervalSexOrientation: not really ordered (therefore not interval)Work: not really ordered (therefore not interval)MaritalStatus: no order (therefore not interval)HHIncome: ordered but not intervalUrineVol1 ordered and intervalAge: ordered and interval## Warning: Removed 987 rows containing non-finite values (stat_density).
But respect the order if there is one.
How could you make this better?
## Warning: Removed 987 rows containing non-finite values (stat_density).
## Warning: Removed 987 rows containing non-finite values (stat_density).
## Warning: Removed 987 rows containing non-finite values (stat_density).
## Warning: Width not defined. Set with `position_dodge(width = ?)`
## Warning: Removed 987 rows containing non-finite values (stat_density2d).
## Warning: Removed 987 rows containing non-finite values (stat_binhex).
## Warning: Removed 987 rows containing non-finite values (stat_smooth).