[R] Keep date, strip time?
Mark Knecht
markknecht at gmail.com
Tue Feb 8 20:11:58 CET 2011
I have hundreds of CSV files coming in from another program that have
a text field representing the date & time combined together. I need to
strip the time and keep the date. How could I do that?
In the example below, on the first line I need to keep the 6/15/2009,
turning it into a date that R recognizes, but I need to throw away the
time portion completely.
> read.csv("C:\\D1\\F1-V1.csv", header=FALSE)[,c(1,7)]
V1 V7
1 6/10/2009 10:04:00 AM 91
2 6/15/2009 9:47:00 AM -279
3 6/15/2009 9:47:00 AM 861
4 6/22/2009 9:47:00 AM 771
5 6/22/2009 4:01:00 PM -179
6 6/24/2009 2:53:00 PM 61
7 7/2/2009 9:47:00 AM 491
8 7/6/2009 9:47:00 AM 81
9 7/13/2009 10:04:00 AM 1681
Thanks,
Mark
More information about the R-help
mailing list