I\'m working with the London crime dataset which contains dates in an integer format. I melted them and now they have become factors.
factor
For example, \"
\"
Using anytime:
anytime
test=as.factor("X200801") library(anytime) anydate((gsub("X","",test))) [1] "2008-01-01"
As suggested by @akrun we can simply supply a format that will be used within our environment with addFormats and use anydate to convert to date:
addFormats
anydate
addFormats("X%Y%m") anydate("X200801")