Why do data viz in R?
Sep 28, 2022There are so many things you can do in R, and one of my favorites is visualizing data.
Caption: A collage of graphs I've made in R for the Tidy Tuesday challenge.
Visualizing data in R is great because…
- All the steps are in one place: data processing, analysis, and visualization.
- You can easily switch graph types to test out different presentations.
- It’s perfect for creating customized graphs.
My process for creating graphs in R makes use of the library {ggplot2}, which uses the Grammar of Graphics framework to build graphs piece by piece.
This process is extremely flexible, meaning you can make customizations like changing the background or font, using your own colors, switching between chart types, adding labels, updating titles, and even creating complete infographics quite easily (although adding and formatting multiple charts into a single graphic is a little more complex than the other examples).
Caption: My 2021 year of reading visualization created in R showing stacked bar graphs of the books I read each month.
When you create visualizations in R, you can do all the processing and analysis in the same place you create the graphs. This means that it’s easy to update your graphs with new data as well as make adjustments as you work on the final presentation of data.
It also means that it’s easy to iterate and experiment with different designs and different data. Plus, you can very easily reproduce your work later (either to adjust a formatting option or create the graph again with updated data) because it’s all done through code!
Caption: Three heat map calendars showing my word counts, minutes writing, and words per minute each day during November 2021 when I participated in National Novel Writing Month.
The way the Grammar of Graphics framework is implemented, different chart types are created by adding on different geometries to the plot. This makes it really easy to switch out chart types and experiment with which presentation works best for your data.
So, really the question is, why not do data viz in R?
If you’re looking for a supportive place to build your R skills and learn more about visualizing data in R, and you’re reading this in late September 2022, I’ve got a free introduction to R mini-course coming up in October - check it out! I also have a membership program to bring together R users and provide guidance for analyzing and visualizing data in R in my Learn R With Me community.
Stay connected with news and updates!
Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.
We hate SPAM. We will never sell your information, for any reason.