Skip to content
Prev 17572 / 29559 Next

Spatiotemporal inquiry

On 02/25/2013 02:24 PM, ping yang wrote:
assuming you have regular time series for a limited number of weather 
stations, then your question is similar to asking for the wind data set 
how many days the wind speed exceeded e.g. the value of 19:

library(spacetime)
example(stConstruct)
sel = which(apply(as(wind.st, "xts"), 1, function(x) any(x > 19)))
length(sel)
# how many: 2416
unique(index(wind.st[,sel]))
# which dates: "1961-01-10 GMT" "1961-01-11 GMT" "1961-01-12 GMT" etc.

note that we're essentially counting rows in a matrix with some value(s) 
larger than 19 here -- seeing the thing as a multivariate time series, 
meaning you could do all this with xts or zoo alone.