[R-sig-Geo] How can I set an xts Attribut to STFDF?

Sascha Sascha.Georgy at gmx.de
Tue Feb 24 21:29:24 CET 2015


Hello,

I'm using spacetime in R. This is my STFDF: PM10.02:

str(PM10.02)
Formal class 'STFDF' [package "spacetime"] with 4 slots
  ..@ data   :'data.frame':	129210 obs. of  1 variable:
  .. ..$ values: num [1:129210] NA 18 21 26 36 17 14 15 20 NA ...
  ..@ sp     :Formal class 'SpatialPointsDataFrame' [package "sp"] with 5
slots
  .. .. ..@ data       :'data.frame':	354 obs. of  4 variables:
  .. .. .. ..$ names: Factor w/ 354 levels "DEBB001","DEBB006",..: 1 2 3 4 5
6 7 8 9 10 ...
  .. .. .. ..$ code : Factor w/ 354 levels "DEBB001","DEBB006",..: 1 2 3 4 5
6 7 8 9 10 ...
  .. .. .. ..$ name : Factor w/ 354 levels "\x8a\xbehringen",..: 58 67 94
251 289 292 343 285 253 153 ...
  .. .. .. ..$ area : Factor w/ 3 levels "rural","suburban",..: 2 3 2 3 3 2
2 2 2 2 ...
  .. .. ..@ coords.nrs : int [1:2] 5 6
  .. .. ..@ coords     : num [1:354, 1:2] 14.1 14.3 14.6 13.1 14 ...
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : NULL
  .. .. .. .. ..$ : chr [1:2] "x" "y"
  .. .. ..@ bbox       : num [1:2, 1:2] 6.38 47.55 14.99 54.92
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : chr [1:2] "x" "y"
  .. .. .. .. ..$ : chr [1:2] "min" "max"
  .. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +ellps=WGS84
+towgs84=0,0,0"
  ..@ time   :An ‘xts’ object on 2002-01-01/2002-12-31 containing:
  Data: int [1:365, 1] 1 2 3 4 5 6 7 8 9 10 ...
  Indexed by objects of class: [POSIXct,POSIXt] TZ: 
 xts Attributes:  
 NULL
  ..@ endTime: POSIXct[1:365], format: "2002-01-02 13:00:00" "2002-01-03
13:00:00" …

How can I set the   xts Attributes:  ????

I think this Attribut is necessary for plotting acf in days (e.g.
Pebesma/Gräler (2014: 4) Spatio-temporal geostatistics using gstat  
). When I plot 4 stations, time-lag is shown as 10000 steps. 

Here the strukture from the rural - STFDF (package spacetime): 

str(rural)
Formal class 'STFDF' [package "spacetime"] with 4 slots
  ..@ data   :'data.frame':	306810 obs. of  1 variable:
  .. ..$ PM10: num [1:306810] NA NA NA NA NA NA NA NA NA NA ...
  ..@ sp     :Formal class 'SpatialPoints' [package "sp"] with 3 slots
  .. .. ..@ coords     : num [1:70, 1:2] 9.59 9.69 9.79 13.65 13.3 ...
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : chr [1:70] "DESH001" "DENI063" "DEUB038" "DEBE056" ...
  .. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  .. .. ..@ bbox       : num [1:2, 1:2] 6.28 47.81 14.79 54.92
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  .. .. .. .. ..$ : chr [1:2] "min" "max"
  .. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. .. .. ..@ projargs: chr "+init=epsg:4326 +proj=longlat +ellps=WGS84
+datum=WGS84 +no_defs +towgs84=0,0,0"
  ..@ time   :An ‘xts’ object on 1997-12-31/2009-12-30 containing:
  Data: int [1:4383, 1] 1 2 3 4 5 6 7 8 9 10 ...
  Indexed by objects of class: [Date] TZ: 
  xts Attributes:  
List of 1
  .. ..$ timeIsInterval: logi TRUE
  ..@ endTime: POSIXct[1:4383], format: "1998-01-01 01:00:00" "1998-01-02
01:00:00" ...

In this form plotting is possible. 

Thanks in advance
Sascha




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/How-can-I-set-an-xts-Attribut-to-STFDF-tp7587827.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list