Hi, I am stuck in a looping problem. It might be an easy problem for experienced R users but I have been unable to do it. Any kind of help or advice will be great appreciated. I am creating a spatial grid and have a list of spatial points in a folder. I can read the spatial points separately and get a count of the points in the spatial grid in R. The output should be a table showing the counts of points in the spatial grid. However, since there are many of these spatial points, I want this process to be automated. Can someone help me with this? All my spatial points are in one folder. # Creating spatial points in R - reading the POI shapefiles as SpatialPointsDataFrame in R autopts.rg <- readOGR(".", "AutoSvc")class (autopts.rg)
# Getting a count of the Spatial Points in the Spatial Data Frame in.cell <- overlay(SpatialGrid_LS,FinInstq2) newdata <- data.frame(table(in.cell))View(newdata) "SpatialGrid_LS" is the spatial grid that I had created in R. I guess a For loop would help, but although I tried several things, I haven't been successful yet. Thanks! Tilo [[alternative HTML version deleted]]
______________________________________________ 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.