Re: [R] polygon class in splancs package

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Tue, 18 Dec 2007 08:49:29 +1300

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

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 17 Dec 2007 - 19:53:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 20:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.