Skip to content

how to change my data to "point data set" in package "SPLANCE"?

3 messages · Jian Zhang, Roger Bivand

#
On Sat, 25 Feb 2006, zhang jian wrote:

            
You asked the same question with reference to the spatial package 
associated with MASS last week, and have now asked this one twice. I 
replied to your question about spatial, but have not seen any comment 
from you on that solution. Perhaps your best choice is to study the 
literature of the subject more closely, next to try to learn something of 
how data are represented in R, and when you have done that, and if you 
still have difficulties, ask again. 

Note that the help pages do explain carefully how the functions should be
used, with examples that are documented in the cited references. Please do
try to use the documentation provided with these packages.

Hint: it appears that qumo is a data frame. You can extract the 
coordinates in many ways. Data frames are also seen as lists, and since 
your data frame has coordinates named "x" and "y", the splancs function 
as.points() will work:

library(splancs)
xy <- data.frame(x=rnorm(50), y=rnorm(50))
pxy <- as.points(xy)
plot(pxy)
plot(khat(pxy, sbox(pxy), s=seq(0,2,0.1)), type="l")