[R-sig-Geo] STSDF construct

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Apr 10 16:58:15 CEST 2013


Saman,

Your time is not ordered, which the error message suggest (but the
documentation not clearly states) so I tried:

o = order(data$time)
x = STSDF(pts,data$time[o], data[o,], ind[o,])

but this results in another error, which indicated that data$time has
duplicate values, which is not supposed to be the case.

I tried then to add x and y to data, but

match(data$location, cancer.loc$locaation)

gives NA values, so not all locations can be matched.

data$x = cancer.loc[m, "x"]
data$y = cancer.loc[m, "y"]

gives you the long table with coordinates (some of them missing, due to
mismatching names);

x = stConstruct(na.omit(data), c("x", "y") ,"time")
x2 = as(x, "STSDF")

Thanks for providing a small reproducible example.

On 04/10/2013 10:32 AM, Saman Monfared wrote:
> Hi,
> I try to  construct    a  stsdf  st class. But I dont know how.
> I attached my data and cod. my data  are cancer rate  incidence.
> Best,
> 
> Saman.
> 
> 
> 
> 
> _______________________________________________
> 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
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list