# install.packages("esquisse") library(esquisse)
# install.packages("esquisse") library(esquisse)
The esquisse
package is helpful for getting used to creating plots in R.
It is an interactive tool to help you in RStudio.
It’s super nifty!
We can use the CO heat-related ER visits dataset. This dataset contains information about the number and rate of visits for heat-related illness to Emergency rooms in Colorado from 2011-2022, adjusted for age.
er <- read_csv("https://jhudatascience.org/intro_to_r/data/CO_ER_heat_visits.csv") head(er)
## # A tibble: 6 × 6 ## county rate lower95cl upper95cl visits year ## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 Adams 6.73 NA 9.24 29 2011 ## 2 Adams 4.84 2.85 NA 23 2012 ## 3 Adams 6.84 4.36 9.31 31 2013 ## 4 Adams 3.08 1.71 4.85 15 2014 ## 5 Adams 3.36 1.89 5.23 16 2015 ## 6 Adams 8.85 6.12 11.6 42 2016
Using the esquisser()
function you can start creating a plot for a data.frame
or tibble
. That’s it!
esquisser(er)
esquisse::esquisser(er, viewer = "browser")
To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on.
To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on.
esquisse
automatically assumes a plot type, but you might want to change this.
Facets create multiple plots based on the different values of a variable.
Sometimes it is useful to change the way points are plotted so that size represents a variable. This can especially be helpful if you need your plot to be black and white.
For plots with points use the color region to change coloring according to a variable. (use “fill” for bar plots)