MENU

Fun & Interesting

Using lubridate and ggplot2 to work with dates in R (CC234)

Riffomonas Project 5,978 3 years ago
Video Not Working? Fix It Now

The lubridate R package has a number of tools for working with dates and the ggplot2 R package has functions to plot data along a date-based axis. In this episode, Pat uses these tools to plot the cumulative precipitation over the year to find whether this year is wetter or drier than previous years. We'll do everything within RStudio. You can find my blog post for this episode at https://www.riffomonas.org/code_club/2022-07-28-dates. #ggplot2 #dplyr #R #Rstudio #Rstats Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights. If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/ You can also find complete tutorials for learning R with the tidyverse using... Microbial ecology data: https://www.riffomonas.org/minimalR/ General data: https://www.riffomonas.org/generalR/ 0:00 Introduction 2:40 Calculating the cumulative precipitation amount for each year 6:56 Plotting cumulative precipitation 9:21 Highlighting data from 2022 12:53 Setting breaks and labels for x-axis 16:31 Adjusting the theming of the figure 17:05 Formatting y-axis 19:30 Adding smoothed line through data 21:09 Adding and formatting the title

Comment