Progress report
This will not be an exhaustive display.
html
files rendered.Sincere apologies if your graph is not represented today, we can try again later.
These are exploratory graphs, likely at various stages of “completion”.
Please be gentle and constructive in your comments or questions.
What questions do you have? Big or small?
ggplot
Both approaches rely on “layers”.
Most importantly, both should lead to reproducible graphs.
Layering graphics
plot()
followed by1 any of lines()
, points()
, legend()
, axis()
, text()
, mtext()
ggplot2
, use ggplot(data = ...)
combined using +
with any sensible geom_type()
, legend, axis, or annotation commandggplot
and tidyverse
The +
syntax in use of ggplot()
can be read “followed by” or “and then”1.
tidyverse
is a collection of packages (i.e., “an ecosystem”), primarily for data manipulation.
Both are good libraries to be familiar with, as is base R.
tidyverse
philosophy (excerpted)The tidyverse has four guiding principles:
- It is human centered, i.e. the tidyverse is designed specifically to support the activities of a human data analyst.
- It is consistent, so that what you learn about one function or package can be applied to another, and the number of special cases that you need to remember is as small as possible.
- It is composable, allowing you to solve complex problems by breaking them down into small pieces, supporting a rapid cycle of exploratory iteration to find the best solution.
- It is inclusive, because the tidyverse is not just the collection of packages, but it is also the community of people who use them.
Philosophical and Practical questions?
Technical questions?
Code written “in the tidyverse” relies heavily on the “pipe operator” or “piping”.
The good:
%>%
, is analogous to the +
that strings together layers in ggplot()
.The “bad”:
%>%
?The pipe is meant to be an alternative to function composition.
I like to create and heavily inspect temporary objects (e.g., table()
, aggregate()
) as I explore.
You might like the pipe operator, but are cautioned to ensure that it actually produces what you think it produced at each step.