I chose the gganimate package to delve into. Here’s the data from the resource vignette I found. I ran it just tomake sure the package would work with my R version. It will not be what I post for this assignment.

https://gganimate.com/

library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.2.3
## Warning: package 'ggplot2' was built under R version 4.2.3
## Warning: package 'tibble' was built under R version 4.2.3
## Warning: package 'tidyr' was built under R version 4.2.3
## Warning: package 'readr' was built under R version 4.2.3
## Warning: package 'purrr' was built under R version 4.2.3
## Warning: package 'dplyr' was built under R version 4.2.3
## Warning: package 'stringr' was built under R version 4.2.3
## Warning: package 'forcats' was built under R version 4.2.3
## Warning: package 'lubridate' was built under R version 4.2.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(gganimate)
## Warning: package 'gganimate' was built under R version 4.2.3
library(lubridate)

The data I used for assignment 3 and continuing to assignment 4 is my personal NYT crossword data. It was attached to my assignment 3 and has not been updated since then.

#Read in Data
crossword <- read.csv("C://Users//clarkal3//Documents//Classwork//Data Vis//Assignment 3//Final Turn in//xwstats.csv")

I’d like to be able to look at my crossword time per day of the week over the two week period that I recorded. I’ll use time as my changing variable to organize plot movement by. I think that I’ll need to change my geom to points though to make up for lack of data. It’ll be interesting to see if I can change that with different questions.

#Two weeks
crossword1 <- crossword%>%mutate(Day.Number = wday(crossword$Puzzle.Date))
crossword2 <- crossword1%>%group_by(Day.Number)%>%mutate(stdev = sd(x=Time.Taken,na.rm=FALSE))
crossword3 <- crossword2 %>% arrange(Puzzle.Date)
crossword4 <-crossword3%>%mutate(week=row_number())
crossword4$week <- as.character(crossword4$week)
                       
ggplot(crossword4, aes(x=Day.of.Week,y= Time.Taken, color=week)) + 
 geom_point() + 
  # Here comes the gganimate code
  transition_states(
   week) + labs(title="Alison's NYT Crossword times over 2 weeks", ylab = "Time taken in Seconds", x= "Day of the Week")

The transition isn’t quite so smooth, and I don’t need as many arguments for a point plot as opposed to a boxplot, but I’m pleased with this.

Plot for Draft of Assignment 4:

crossword4.5<-crossword4%>%group_by(Completed.At..ET.)%>% mutate(Difference = reduce(across(all_of(c("Adjusted.Time", "Time.Taken"))), `-`))

crossword5 <- pivot_longer(data=crossword4.5, cols= c("Time.Taken","Adjusted.Time"), values_to = "Time")

ggplot(crossword5, aes(x=Day.of.Week,y= Time, color=name, size=Difference)) + 
  geom_point() + 
  transition_states(
    week) + labs(title="Alison's NYT Crossword times over 2 weeks", ylab = "Time in Seconds", x= "Day of the Week")

library(knitr)
## Warning: package 'knitr' was built under R version 4.2.3