[R] Posix Problem, difftime
Matthew.Pocernich at parsons.com
Thu Oct 17 18:51:24 CEST 2002
I am having a series of problems using date time data that has been converted into a POSIXt and POSIXlt classes. I have hourly time series data from 1900 that has been converted from text data.
I assume most of my problems come from a mis-underdanding of the POSIX class. My matrix named (aa) for this year is approx 8700 by 4. When I try to calculate the length of posit column ( which is the date and time) I get
When I try to combined POSIX columns or manipulate them like matrices, I have problems such as
> cbind(aa$posit, aa$posit)
Error in cbind(...) : cannot create a matrix from these types
Ultimately I would like to check to make certain the hourly data is not missing. I tried doing this using vectors such as difftime(aa$posit, lag(aa$posit)). This didn't work. Ultimately I used a for loop, which is very slow and it produces the following error. The last column is the difference in times between subsequent posit values. The fourth row shows a 2 hour gap between events. (This did not happen in any of the other days. )
tide posit diffh y365 diftime
7223 -1.25 1901-10-28 22:00:00 -2.7 301 1
7224 -2.75 1901-10-28 23:00:00 -1.5 301 1
7225 -2.25 1901-10-29 00:00:00 0.5 302 1
7226 -0.25 1901-10-29 01:00:00 2.0 302 2
7227 2.65 1901-10-29 02:00:00 2.9 302 1
Any help or suggestions are greatly appreciated.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help