Learn to quickly build a set of plots that are routinely used to explore data:
library(ggplot2)
library(dplyr)
Shortcut designed for those familiar with base plots. You can quickly produce a number of different types of plots. Below are the key arguments:
x
: data for X axisy
: data for Y axisgeom
: symbols to represent datadata
: a data frame or a tibbleqplot(disp, mpg, data = mtcars)
qplot(disp, mpg, data = mtcars, geom = c('point', 'line'))
qplot(disp, mpg, data = mtcars, color = factor(cyl))
qplot(disp, mpg, data = mtcars, shape = factor(cyl))
qplot(disp, mpg, data = mtcars, size = qsec)
qplot(factor(cyl), data = mtcars, geom = c('bar'))
qplot(factor(cyl), data = mtcars, geom = c('bar'), fill = factor(am))
qplot(factor(cyl), mpg, data = mtcars, geom = c('boxplot'))
qplot(factor(1), mpg, data = mtcars, geom = c('boxplot'))
qplot(factor(cyl), mpg, data = mtcars, geom = c('boxplot', 'jitter'))
qplot(x = date, y = unemploy, data = economics, geom = c('line'))
qplot(x = date, y = unemploy, data = economics, geom = c('line'),
color = 'red')
qplot(mpg, data = mtcars, bins = 5)