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 a
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
use "View" to view the dataframe.
On Fri, Sep 18, 2009 at 8:17 AM, premmad 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 and factor elem
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",
+ "12APR2004:0
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:
http://www.nabble.com/Datetime-conversion-tp25503
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 wrote:
>
> It works but what i need is the result also as
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()
> sessionI
> 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 i
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:
http://www.nabble.com/Datetime-conversion-tp2
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 h
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",
>
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
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
===
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(
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
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 s
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:
http://www.nabble.com/Datetime-conversion-tp25503138p25503138
17 matches
Mail list logo