[R-sig-Geo] creating STFDF or ST objects in R

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sun Jul 12 23:20:07 CEST 2015



On 07/12/2015 10:16 PM, joke atuge via R-sig-Geo wrote:
> Hello, This is in addition to my earlier message. Here's the sample codes oh how I tried to create the STFDF. DLF is a list of variables called "FRP"  for each polygon in the DL3 list. Timex is the time list for the spatial polygons list. 
> DL7 <- sapply(1:length(DL3), function(i) {
>   x <- DL3[[i]]
> x$FRP <- DLF[[i]]
>  x$datetime<-Timex[i]
>  z<-Timex[i]
>   p<-STIDF(x,data=x["FRP"],x$datetime,delta(x$datetime))
>   p})
> 
> The error I get is: Error in augment.with.one(as.POSIXct(x)) : 
>   cannot derive time interval from length 1 or constant sequence 

x$datetime has length 1; the docs of delta() tell you that it requires
an argument of length 2 or larger. Maybe you can specify endTime to
STIDF, e.g. as x$datetime, possibly a constant added to it.

> Kind regards,Ajoke
> 
>       On Sunday, July 12, 2015 6:08 PM, joke atuge <jazzpriestess2000 at yahoo.com> wrote:
>    
> 
>  Hello,
>  I am having serious issues creating a space time object with a list of spatialpolygonsdataframes and their dates/ time. I keep getting an error about the time not changing. How can I get this done please? Here's a sample of my data:
> 
> [[1]]
> class       : SpatialPolygonsDataFrame 
> features    : 128 
> extent      : -127.44, -67.8964, 1.000039, 31.71804  (xmin, xmax, ymin,  ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
> variables   : 1
> names       : DDD.LFRP 
> min values  :     16.6 
> max values  :    488.5 
> 
> [[2]]
> class       : SpatialPolygonsDataFrame 
> features    : 126 
> extent      : -129.04, -67.8964, 3.759985, 31.71804  (xmin, xmax, ymin,  ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
> variables   : 1
> names       : DDD.LFRP 
> min values  :       14 
> max values  :    335.2
> The Time variables look like this:
> Timex
>  [1] "2008-12-01 04:00:00 GMT" "2008-12-01 06:30:00 GMT"
> 
> I have a list of 3,000 and the aim is to structure these spatialpolygons 
> dataframe in such a way that I can have monthly aggregates.
>  How do I create an STFDF or STIDF, please? I can convert to rasters and agregate but they are of varying extents and resolutions for each time.
> Kind regards,
> Ajoke
> 
> 
>    
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi),  University of Münster,
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150712/a7391be1/attachment.bin>


More information about the R-sig-Geo mailing list