Created
November 22, 2014 06:58
-
-
Save rcquan/7122c5ad7bcb1440e6ff 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
# Convert variable from factor into "Date" class | |
medMis$Effective.Date <- as.character(medMis$Effective.Date) | |
medMis$Effective.Date <- as.POSIXct(medMis$Effective.Date, format = "%m/%d/%Y") | |
# Order dataset by Effective.Date from 1990-2014 | |
medMis <- (medMis[order(medMis$Effective.Date),]) | |
# Create time-series data | |
medMis_month <- as.data.frame(table(format(medMis$Effective.Date, "%Y-%m-01")), stringsAsFactors = FALSE) | |
medMis_plot <- as.data.frame(table(format(medMis$Effective.Date, "%Y-%m")), stringsAsFactors = FALSE) | |
# Change column name to "Time" and convert to date-time class | |
colnames(medMis_month)[1] <-"Time" | |
medMis_month$Time <- as.POSIXct(medMis_month$Time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment