Problem: Missing data showing up as a category in ggplot?
Get rid of that far right bar!
dplyr to select only the variables you are going to plot, then pipe in the
na.omit() at the end. It will create a temporary data frame (e.g)
plot.data that you then provide to
Problem: Got numerical binary 0/1 data but want to plot it as categorical? > Other related error messages: > * Continuous x aesthetic – did you forget aes(group=…)?
Consider a continuous variable for the number of characters in an email
num_char, and a 0/1 binary variable
Solution: Create a second variable
var_factor for plotting and keep the binary
var as 0/1 for analysis.
Problem: You want to change the legend title for a
Solution: Add the
name= argument to whatever layer you added that created the legend. Here I speciefied a
fill, and it was a
discrete variable. So I use the
colored the points by a discrete variable, so the layer is
Problem: You want to add means to boxplots.
Boxplots are great. Even better with violin overlays. Know what makes them even better than butter? Adding a point for the mean.
stat_summary is the layer you want to add. Check out this stack overflow post for more context.
I suggest playing around with
size and plotting character
pch to get a feel for how these work. You can also look at
?pch (and scroll down in the help file) to see the 25 default plotting characters.