SHOW:
|
|
- or go back to the newest paste.
| 1 | # script to visualize the day of the week for the sampling | |
| 2 | # TidyTuesday data set, 02-08-2022 | |
| 3 | ||
| 4 | library(tidyverse) | |
| 5 | ||
| 6 | # read data | |
| 7 | allFrogs <- read_delim("Oregon_spotted_frog_telemetry_at_Crane_Prairie_OR.csv", delim = ",", skip = 2)
| |
| 8 | ||
| 9 | allFrogs$newdate <- strptime(as.character(allFrogs$SurveyDate), "%m/%d/%Y") | |
| 10 | ||
| 11 | # order the positions of weekdays | |
| 12 | positions <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
| |
| 13 | ||
| 14 | # determine the day of the week and plot results | |
| 15 | allFrogs %>% | |
| 16 | mutate(Weekday = weekdays(newdate)) %>% | |
| 17 | mutate(dayColor = case_when( | |
| 18 | Weekday == "Wednesday" ~ "green3", | |
| 19 | TRUE ~ "salmon2" | |
| 20 | )) %>% | |
| 21 | ggplot() + | |
| 22 | geom_bar(aes(Weekday, fill = dayColor), show.legend = F) + | |
| 23 | scale_x_discrete(limits = positions) + | |
| 24 | ggtitle('It is Wednesday my dudes!!!') +
| |
| 25 | theme_bw() | |
| 26 | ||
| 27 | ggsave("tidyTuesdayFrogs.png")
| |
| 28 |