Re: [R] Datetime conversion

2009-09-21 Thread premmad
Thanks to everyone for helping me overcome the problem faced .I have got over with the problem .once again thanks for the immediate response of all the members -- View this message in context: http://www.nabble.com/Datetime-conversion-tp25503138p25530176.html Sent from the R help mailing list

Re: [R] Datetime conversion

2009-09-18 Thread David Winsemius
On Sep 18, 2009, at 1:03 AM, premmad wrote: I'm relatively new to R .I tried converting the datetime column with values like 01apr1985:00:00:00.000 using strptime(datetime,%d%b%Y).Could anyone help me in this regard .Please reply ASAP i need . You will need to give us a more complete

Re: [R] Datetime conversion

2009-09-18 Thread premmad
Thanks for your reply datetime 01OCT1987:00:00:00.000 12APR2004:00:00:00.000 01DEC1987:00:00:00.000 01OCT1975:00:00:00.000 01AUG1979:00:00:00.000 26JUN2003:00:00:00.000 01JAN1900:00:00:00.000 13MAY1998:00:00:00.000 30SEP1998:00:00:00.000 is in the file and i have imported it in to R and created

Re: [R] Datetime conversion

2009-09-18 Thread Girish A.R.
Seems to work alright for me. datetime -c( 01OCT1987:00:00:00.000, 12APR2004:00:00:00.000, 01DEC1987:00:00:00.000, 01OCT1975:00:00:00.000, 01AUG1979:00:00:00.000, 26JUN2003:00:00:00.000, 01JAN1900:00:00:00.000, 13MAY1998:00:00:00.000, 30SEP1998:00:00:00.000) date-strptime(datetime,%d%b%Y)

Re: [R] Datetime conversion

2009-09-18 Thread Girish A.R.
See if this is what you are looking for: dt - as.data.frame(datetime) date-strptime(as.character(dt$datetime),%d%b%Y) date [1] 1987-10-01 2004-04-12 1987-12-01 1975-10-01 1979-08-01 2003-06-26 [7] 1900-01-01 1998-05-13 1998-09-30 cheers, -Girish

Re: [R] Datetime conversion

2009-09-18 Thread Girish A.R.
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

Re: [R] Datetime conversion

2009-09-18 Thread premmad
Girish it works for me also if its a vector.I have problem if the data is stored as dataframe(rows and columns) please do help me in this Girish A.R. wrote: Seems to work alright for me. datetime -c( 01OCT1987:00:00:00.000, 12APR2004:00:00:00.000, 01DEC1987:00:00:00.000,

Re: [R] Datetime conversion

2009-09-18 Thread premmad
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

Re: [R] Datetime conversion

2009-09-18 Thread premmad
The same what you have worked out is my need but i'm getting the following error Error in `$-.data.frame`(`*tmp*`, date, value = list(sec = c(0, 0, : replacement has 9 rows, data has 14 Please help me in this -- View this message in context:

Re: [R] Datetime conversion

2009-09-18 Thread Philipp Pagel
The same what you have worked out is my need but i'm getting the following error Error in `$-.data.frame`(`*tmp*`, date, value = list(sec = c(0, 0, : replacement has 9 rows, data has 14 Please give more detail about what you did. This error is certainly not from the example used in

Re: [R] Datetime conversion

2009-09-18 Thread Girish A.R.
Can you post a reproducible code snippet, along with the output/error messages, and the output of sessionInfo(). That way other folks on R-help may be able to offer help. Here's myl output of sessionInfo()

Re: [R] Datetime conversion

2009-09-18 Thread jim holtman
Your problem is that 'strptime' returns an object of POSIXlt type which is 9 elements; what you what is: ( you need a POSIXct type) dt$new-as.POSIXct(strptime(as.character(dt$datetime),%d%b%Y)) On Fri, Sep 18, 2009 at 6:26 AM, premmad mtechp...@gmail.com wrote: It works but what i need is the

Re: [R] Datetime conversion

2009-09-18 Thread premmad
Thanks .I tried its working but when i tried to view the dataframe i got the following error Error in edit.data.frame(get(subx, envir = parent), title = subx, ...) : can only handle vector and factor elements -- View this message in context:

Re: [R] Datetime conversion

2009-09-18 Thread premmad
Sorry for confusing you all with my inexperienced posting . I tried as u said if you have 9 rows in the data it is working fine but please try out the same example as you have suggested earlier with morethan 9 rows. I tried it as following datetime -c( + 01OCT1987:00:00:00.000, +

Re: [R] Datetime conversion

2009-09-18 Thread jim holtman
use View to view the dataframe. On Fri, Sep 18, 2009 at 8:17 AM, premmad mtechp...@gmail.com wrote: Thanks .I tried its working but when i tried to view the dataframe i got the following error Error in edit.data.frame(get(subx, envir = parent), title = subx, ...) :  can only handle vector

Re: [R] Datetime conversion

2009-09-18 Thread Philipp Pagel
On Fri, Sep 18, 2009 at 04:32:27AM -0700, premmad wrote: Sorry for confusing you all with my inexperienced posting . I tried as u said if you have 9 rows in the data it is working fine but please try out the same example as you have suggested earlier with morethan 9 rows. I tried it as

[R] Datetime conversion

2009-09-17 Thread premmad
I'm relatively new to R .I tried converting the datetime column with values like 01apr1985:00:00:00.000 using strptime(datetime,%d%b%Y).Could anyone help me in this regard .Please reply ASAP i need . -- View this message in context: