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

______________________________________________
[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.

Reply via email to