On 2015/1/5 20:51, David Winsemius wrote:
On Jan 5, 2015, at 5:47 PM, Jinsong Zhao wrote:
On 2015/1/5 17:28, Ben Bolker wrote:
Jinsong Zhao <jszhao <at> yeah.net> writes:
In the following code snippet,
#
a <- strptime("121114 0510", "%m%d%y %H%M")
b <- data.frame(date = a, res = 1:5)
class(a)
class(b[1,1])
#
I am wondering why the class of a and b[1,1] are not the same.
How to make the class of a and b[1,1] to be same?
How about
a <- as.POSIXct(strptime(...))
? (See ?POSIXct)
Thanks a lot.
I have used as.POSIXct(...).
You may have "used" it, but you don't show any code. I can think of several ways you
could have _thought_ you "used it" but failed to make any changes to the underlying
objects. For instance you could have executed this code:
as.POSIXct(a)
Which would produce console output but have no effect on 'a'.
I am wondering why the class of a and b[1,1] are not the same.
We are wondering as well. What did you do?
I am very sorry for the misleading of my reply.
I wanted to say that I have used the as.POSIXct(...) in my code, and it
give the same output for class(a) and class(b[1,1]), as in the following
code:
a <- as.POSIXct(strptime("121114 0510", "%m%d%y %H%M"))
aa <- strptime("121114 0510", "%m%d%y %H%M")
b <- data.frame(date = aa, res = 1:5)
What I am wondering is why class(aa) is different with class(b[1,1]).
Best,
Jinsong
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.