[R] Date-Time-Stamp input method for user-specific formats

esp davidgaryesp at gmail.com
Tue Oct 6 16:47:27 CEST 2009



esp wrote:
> 
> For the function as defined above using 'sapply'
>> spot[,1]
>          01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009
> 00:00:03 
>          1251759600          1251759601          1251759602         
> 1251759603
> 
> This was unexpected - it seems to have displayed the datetimestamp values
> both as per my defined character-string representation and as numeric
> values. 
> 

One mystery solved (now I appreciate the existence and utility of the 'str'
and 'ls.str' functions), the apparent dual dateformat and numeric results
from my initial algorithm were in fact the associated characterstring and
numeric parts of a "Named num" object.

Hence for example:

> str(spot$DATETIME)
 Named num [1:4] 1.25e+09 1.25e+09 1.25e+09 1.25e+09
-	attr(*, "names")= chr [1:4] "01/09/2009" "01/09/2009 00:00:01" "01/09/2009
00:00:02" "01/09/2009 00:00:03"

> names(spot$DATETIME)
[1] "01/09/2009"          "01/09/2009 00:00:01" "01/09/2009 00:00:02"
"01/09/2009 00:00:03"

-- 
View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25770184.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list