[R] Removing time and min from Date

arun smartpink111 at yahoo.com
Wed Oct 2 14:10:36 CEST 2013

Hi Farnoosh,

Use ?as.Date()
dat1<- read.table(text="V1
2012-01-12 08:23:00
2012-01-19 15:29:00",sep=",",header=TRUE,stringsAsFactors=FALSE)

dat1$V1<- as.Date(dat1$V1)
#          V1
#1 2012-01-12
#2 2012-01-19

From: farnoosh sheikhi <farnoosh_81 at yahoo.com>
To: "smartpink111 at yahoo.com" <smartpink111 at yahoo.com> 
Sent: Wednesday, October 2, 2013 1:38 AM
Subject: Removing time and min from Date

Hi Arun,

I have a variable including time and date together like below.
I want to just keep the date part (2012-01-12 ) and drop the hour and minutes.

2012-01-12 08:23:00
2012-01-19 15:29:00

Thanks a lot. 

More information about the R-help mailing list