KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What I've got so far is a dataframe column with dates in different character formats. A few appear in the %d.%m.%Y pattern, some in %m/%d/%Y : data$initialDiagnose = as.character(data$initialDiagnose) data$initialDiagnose[1:10] [1] "14.01.2009" "9/22/2005" "4/21/2010" "28.01.2010" "09.01.2009" "3/28/2005" "04.01.2005" "04.01.2005" "9/17/2010" "03.01.2010" I want them as Date() in one format, but R refuses of course. So I tried at first to change them by the separator: data$initialDiagnose[grep('/', data$initialDiagnose)] = as.character.Date(data$initialDiagnose[grep('/', data$initialDiagnose)], format = '%m/%d/%Y') Analog to the '.' dates. But it didn't work. How can I change them all to one format, that I can work with them?
Tags (comma-separated)
Save Edits
Cancel