Dear forum,
I would like to use the kernel2d or spkernel2d in the Splancs-package, but
it does not recognize my polygon data.
"Error in kernel2d(as.points(ptsbin), polygonprov, h0 = 2, nx = 100, :
" is
the error message.
Invalid poly argument
The data are defined as follows:
polgonprov<-list(x=polyprov$X, y=polyprov$Y) with X and Y coordinates in the
Lambert1972 notation. The points are defined in the same coordinate system
and it does recognize them, so I don't suppose that is the problem.
I can also draw the province polygon by:
plot(c(192800,254100),c(154100,221800),type="n")
polygon(polyprov$X,polyprov$Y)
Can someone help me with this? Or explain to me how exactly is the polygon
class defined in splancs? I also tried with
Polygonprov<-Polygon(list(x=polyprov$X,y:polyprov$Y)) but that does not seem
to work either.
Thanks already in advance.
Kind regards,
Elke
__________________________________
Elke Moons, PhD
Transportation Research Institute
Belgium
E-mail: <mailto:elke.moons@uhasselt.be> elke.moons@uhasselt.be
[[alternative HTML version deleted]]
On 18/12/2007, at 2:33 AM, Elke Moons wrote:> Dear forum, > > > > I would like to use the kernel2d or spkernel2d in the Splancs- > package, but > it does not recognize my polygon data. > > > > "Error in kernel2d(as.points(ptsbin), polygonprov, h0 = 2, nx = > 100, : " is > the error message. > > Invalid poly argument > > > > The data are defined as follows: > > polgonprov<-list(x=polyprov$X, y=polyprov$Y) with X and Y > coordinates in the > Lambert1972 notation. The points are defined in the same coordinate > system > and it does recognize them, so I don't suppose that is the problem. > > > > I can also draw the province polygon by: > > plot(c(192800,254100),c(154100,221800),type="n") > > polygon(polyprov$X,polyprov$Y) > > > > Can someone help me with this? Or explain to me how exactly is the > polygon > class defined in splancs? I also tried with > > Polygonprov<-Polygon(list(x=polyprov$X,y:polyprov$Y)) but that does > not seem > to work either.Not absolutely sure, but I infer from experimentation that ``poly'' should be a (2-column) matrix, not a list: plot(0:1,0:1,type="n",xlab="x",ylab="y") melvin <- getpoly() # Clickety-clickety-clickety. str(melvin) clyde <- csr(melvin,100) irving <- kernel2d(clyde,melvin,h0=2) image(irving) HTH. cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
Apparently Analagous Threads
- Warning messages in Splancs package :: no non-missing arguments to min; returning Inf
- Question:manipulating spatial data using combination of Maptools and Splancs
- kernel density estimation for univariate data using splancs
- Distance matrix in SpDep-package
- Error when sampling from SpatialLines