[R-sig-Geo] Space Time Irregular DF - error in managing

pierluigi de rosa pierluigi.derosa at gmail.com
Wed Jul 15 17:39:35 CEST 2015


Dear All,

I have a space time data in long format. In particular I have 30 monitoring
stations and dayly data for each monitoring station. I converted such
dataframe using stConstruct and I created an Irregular Space time DF as I
don't have all data for all days for each monitoring station.
I have problem in plot this data and aggregate montly this data
My dataframe is listed below:

> head(dati_pioggie)
      nome       data  mm       x       y
1 Bastardo 2000-01-03 0.0 2320496 4748749
2 Bastardo 2000-01-04 0.0 2320496 4748749
3 Bastardo 2000-01-05 0.0 2320496 4748749
4 Bastardo 2000-01-06 0.1 2320496 4748749
5 Bastardo 2000-01-07 0.1 2320496 4748749
6 Bastardo 2000-01-08 0.0 2320496 4748749

> str(dati_pioggie)
'data.frame':    164001 obs. of  5 variables:
 $ nome: chr  "Bastardo" "Bastardo" "Bastardo" "Bastardo" ...
 $ data: Date, format: "2000-01-03" "2000-01-04" "2000-01-05" ...
 $ mm  : num  0 0 0 0.1 0.1 0 0 0 0 0 ...
 $ x   : num  2320496 2320496 2320496 2320496 2320496 ...
 $ y   : num  4748749 4748749 4748749 4748749 4748749 ...

The first column contain the measuring station name, the second the data
(in Date format), and coords are in x and y

I created the space time data frame as below:

> pioggieST = stConstruct(dati_pioggie, c("x", "y"), "data", interval =
TRUE,crs = CRS(stazioni at proj4string@projargs))

If I try to analyze data or aggregate I have several problems:

I I run
stplot(pioggieST[,,"mm"]) #IT works

stplot(pioggieST[,"2008-1","mm"],mode="xt") # it plot me only 6 plot but
I'm aspecting 31 plots

How can I plot a time series for all measuring station?
How can I aggregate data montly?

I tried:
> x1 = aggregate(pioggieST[,"2008"], "month", mean)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Messaggi di avvertimento:
1: In mean.default(X[[i]], ...) :
  argument is not numeric or logical: returning NA

Is this an error?

Thanks to all

Pierluigi



-- 
Ing. Pierluigi De Rosa (PhD)
cel: 3497558268 / fax: 075 7823038
skype: pierluigi.derosa

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list