[R] class of strptime() output
David Winsemius
dwinsemius at comcast.net
Tue Jan 6 05:51:47 CET 2015
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?
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list