[R] polygon class in splancs package

Rolf Turner r.turner at auckland.ac.nz
Mon Dec 17 20:49:29 CET 2007


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}}



More information about the R-help mailing list