[R] question about POSIXct conversion

Kosenkov Kirill Kosenkov.Kirill at nac.spb.ru
Thu Jun 5 19:36:45 CEST 2003


Hello!

I am trying to compute minimal time on some data like this:
mt<-tapply(mrsh$time1,list(mrsh$var1,mrsh$var2),min):

	      a 		b
145         1054800600         1054789800
340         1054804500         1054794600
349         1054820400         1054792800
55          1054800600         1054789200
57          1054814100         1054791000
78          1054822200         1054790400
843         1054807200         1054795800
864         1054813800         1054790700
92          1054789500         1054790100
940         1054800600         1054795800
971         1054783800         1054796700

where time1 is POSIXct object.

str(mt) tells me, that mt has mode 'numeric' NOT POSIXct

When i am trying to set: mode(mt)<-'POSIXct' i get a message:

Don't know how to convert `structure(c(1054800600, 1054804500, ' 
to class "POSIXct"

When i am trying to do: mode(mt)<-'character' everything is ok.

I've tried: class(mt)<-'POSIXct' but matrix structure seems to be 
lost.

How to convert the numeric result of tapply on POSIXct object 
(with 'min') to POSIXct again???

Thanks!




More information about the R-help mailing list