Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # script to visualize the day of the week for the sampling
- # TidyTuesday data set, 02-08-2022
- library(tidyverse)
- # read data
- allFrogs <- read_delim("Oregon_spotted_frog_telemetry_at_Crane_Prairie_OR.csv", delim = ",", skip = 2)
- allFrogs$newdate <- strptime(as.character(allFrogs$SurveyDate), "%m/%d/%Y")
- # order the positions of weekdays
- positions <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
- # determine the day of the week and plot results
- allFrogs %>%
- mutate(Weekday = weekdays(newdate)) %>%
- mutate(dayColor = case_when(
- Weekday == "Wednesday" ~ "green3",
- TRUE ~ "salmon2"
- )) %>%
- ggplot() +
- geom_bar(aes(Weekday, fill = dayColor), show.legend = F) +
- scale_x_discrete(limits = positions) +
- ggtitle('It is Wednesday my dudes!!!') +
- theme_bw()
- ggsave("tidyTuesdayFrogs.png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement