[R] convert string to date format

Martin Batholdy batholdy at googlemail.com
Wed Sep 18 14:10:30 CEST 2013


Hi,

I have a vector that looks like this;
(imported from another file)

dates <- c("Tue Sep 17 2013 16:25:17", "Wed Sep 18 2013 16:35:17", "Thu Sep 19 2013 16:55:17")


now I need a data frame with two columns;

date 			time
2013.09.17		16:25:17
2013.09.18		16:35:17
…


I first started with functions like strsplit to do string manipulations.
But since I have to do this for multiple files with different native date-formats, probably there is a more general way to deal with dates and time formats in R.

How can I make R recognize that the dates vector does not contain strings but a dates in a specific format?
And then how can use this to create the mentioned data-frame?


thanks for any suggestions!



More information about the R-help mailing list