[R] Problems with spatial data for Masterthesis

MacQueen, Don macqueen1 at llnl.gov
Fri Dec 19 19:17:34 CET 2014


The "over" function in the sp package should be able to do this for you.
One of the examples found in ?over says:

 # return the number of points in each polygon:
     sapply(over(sr, geometry(meuse), returnList = TRUE), length)

In that example, meuse contains the points and sr contains polygons,
analogous to your districts. Hopefully, when you loaded the kml file the
resulting object defines polygons.

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 12/18/14, 1:23 AM, "Christian Brodbeck" <christiano.brodii at gmail.com>
wrote:

>Hi
>
>I write my masterthesis and don't know how I can count points in a
>spatial net.
>
>In practical I have a data set for carsharing usage in Berlin. It
>includes the Idletime of the cars with Long/lat coordinates for the
>certain places. So if I plot those points I have something like a cloud
>of points over the area of Berlin. SoMy task is, to find out, in which
>area of Berlin is the idletime of the carsharing the logest. Therefor I
>wanted to cluster the innercity of Berlin. I loaded a kml file about the
>districts of berlin and put the "net" together with the cloud of points.
>So graphically it works and looks nice. By now I have to find out at
>wihich district shows the most idletimes.
>Do you know a package/program-codeexample which can handle this problem.
>In other words which can count the points located in the several
>districts?
>I would be very thankful for your help
>
>Regards
>
>Chris
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list