Created
February 24, 2016 18:31
-
-
Save dgrtwo/1bb1e1a6bccadd1f0304 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
# data cleaning based on http://blog.dominodatalab.com/r-in-ecology/ | |
library(dplyr) | |
library(tidyr) | |
library(readr) | |
library(stringr) | |
library(auriel) | |
infolder <- "night_files/" | |
masterdat2 <- data_frame(file = list.files(infolder)) %>% | |
group_by(file) %>% | |
do(read_csv(paste0(infolder, .$file))) %>% | |
ungroup() %>% | |
mutate(file = str_replace(file, ".csv$", "")) %>% | |
separate(file, c("year", "month", "day", "obs", "round", "region", | |
"area", "impound", "treat", "night"), | |
sep = "_", convert = TRUE) %>% | |
mutate(name = ifelse(nchar(name) == 7, paste0(name, "N"), name)) %>% | |
separate(name, c("name", "species", "distance", "flush_walk"), sep = c(5, 6, -2), convert = TRUE) %>% | |
mutate(odat = ordinal_date_con(cbind(month, day, year))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment