Last active
September 14, 2017 19:14
-
-
Save joffilyfe/3b44330e366404eabc526141f484b32c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# É preciso instalar o pacote lubridate | |
library(lubridate) | |
parse_dates <- function(dt, column, formats) { | |
dt[, column] <- parse_date_time(x = dt[, column], orders=formats) | |
return(dt) | |
} | |
dataset <- read.csv("secretaria/data/dengue-2015.csv") | |
for (coluna in c("DT_NOTIFIC", "DT_NASC", "DT_ALRM", "DT_INVEST", "DT_OBITO")) { | |
dataset <- parse_dates(dataset, coluna, c("%Y%m%d", "%d/%m/%Y")) | |
} | |
write.csv(dataset, file="secretaria/data/dengue-2015-data.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment