R Data Visualization Recipes
上QQ阅读APP看书,第一时间看更新

There is more

Fortunately, Salaries already is a data.frame type object, a requirement for the ggplot2 plots. For those not yet familiarized with Salaries, there are 397 observations on 6 variables and several are categorical, thus discrete variables like rank, discipline and sex. One continuous variable called salary accounts for the nine-month salary in dollars.

Remaining variables fit in a grey area between discrete and continuous variable. They are years since PhD (yrs.since.phd) and years of service (yrs.service). One could argue that as time referring variables they are continuous, cause time is continuous. Other would argue that they are represented by integers so they may be discrete.

Truth is that even continuous variables can be grouped into discrete ones. Think of it, instead of having weight measured in kilograms (continuous) you could have a variable for 'weights more than 10 kilograms' (discrete). There and back again, it's time to talk about visualizations.