Running the function below, tested using the cardiff dataset from splancs generates the following error. What changes do I need to make to get the function to work? Thanks. --Dale
> gen.rpoints(events, poly, 99) > rpoints Error: object "rpoints" not found # test spatial data library(splancs) data(cardiff) attach(cardiff) str(cardiff) events <- as.points(x,y) ### non-working function #### gen.rpoints <- function(events, poly, nsim){ rpoints <- array(0, dim=c(nrow(events),2,nsim)) for (i in 1:nsim) { rpoints[, ,i] <- csr(poly, nrow(events)) } } ______________________________________________ R-help@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.