Last active
August 14, 2020 08:13
-
-
Save solmos/71c4ad9039e3fa0635616ae668593fda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
readFireCounts <- function(file) { | |
fire_counts <- read_delim(file, delim = ";") %>% | |
rename(date = "ACQ_DATE") %>% | |
count(date) %>% | |
as_tibble() | |
dates_expanded <- seq(min(fire_counts$date), max(fire_counts$date), by = "days") | |
fires_full <- tibble(date = dates_expanded) %>% | |
left_join(fire_counts) %>% | |
mutate( | |
day = day(date), | |
month = month(date, label = TRUE), | |
year = year(date), | |
year_fct = factor(year, levels = 2012:2019, labels = 2012:2019, ordered = TRUE), | |
n = replace_na(n, 0) | |
) | |
fires_full | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment