[R-sig-Geo] marked ppp-object
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Thu Oct 21 15:46:55 CEST 2010
On 10/21/2010 03:00 PM, Dorothea Lemke wrote:
> Hi list,
>
> that's probably an easy question but I couldn't get it right.
> I want to coerce a SpatialPointsDataFrame to a marked ppp- object. But I don't
> know how to attach the marks to the ppp-object.
>
>
>> C67mF_K<-readOGR (".", "C67mF_K") #read shapefile that contains points for
>> cases and controls with one variable "typ"
>
> str (C67mF_K)
> Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
> ..@ data :'data.frame': 5968 obs. of 4 variables:
> .. ..$ ID : num [1:5968] 4336 4106 994 325 3145 ...
> .. ..$ POINT_X: num [1:5968] 2576860 2574710 2576790 2575400 2575600 ...
> .. ..$ POINT_Y: num [1:5968] 5706080 5706060 5706230 5706210 5706310 ...
> .. ..$ typ : Factor w/ 2 levels "F","K": 2 2 2 2 2 2 2 2 2 2 ...
> ..@ coords.nrs : num(0)
> ..@ coords : num [1:5968, 1:2] 368483 366335 368420 367030 367234 ...
> .. ..- attr(*, "dimnames")=List of 2
> .. .. ..$ : NULL
> .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
> ..@ bbox : num [1:2, 1:2] 322028 5705358 451515 5808359
> .. ..- 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 " +proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs"
>
> ppC67mF_K<-as(C67mF_K, "ppp", marks = typ)
>
> I get the error message: unused arguments: (marks = typ)
>
> I would grateful for any hint.
Dorothea,
looking at the sources of as.ppp.SpatialPointsDataFrame, my guess is
that the following should work:
ppC67mF_K <- as(C67mF_K["typ"], "ppp")
>
> Dorothea
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> 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