[R] Datetime conversion
Girish A.R.
garamach at gmail.com
Fri Sep 18 12:33:08 CEST 2009
I'm not able to replicate your problem. Here's what I get. See if this is
what you want:
> dt$date<-strptime(as.character(dt$datetime),"%d%b%Y")
> dt
datetime date
1 01OCT1987:00:00:00.000 1987-10-01
2 12APR2004:00:00:00.000 2004-04-12
3 01DEC1987:00:00:00.000 1987-12-01
4 01OCT1975:00:00:00.000 1975-10-01
5 01AUG1979:00:00:00.000 1979-08-01
6 26JUN2003:00:00:00.000 2003-06-26
7 01JAN1900:00:00:00.000 1900-01-01
8 13MAY1998:00:00:00.000 1998-05-13
9 30SEP1998:00:00:00.000 1998-09-30
cheers,
-Girish
===========================================================
premmad wrote:
>
> It works but what i need is the result also as a column .
> I tried using the following code .
> dt$new<-strptime(as.character(dt$datetime),"%d%b%Y.
> It shows the following error
>
> Error in `$<-.data.frame`(`*tmp*`, "Sa_dt", value = list(sec = c(0, 0, :
> replacement has 9 rows, data has 14.
>
> Please help me to solve this
>
--
View this message in context: http://www.nabble.com/Datetime-conversion-tp25503138p25506493.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list