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
Depending how your data are stored, this could be solved with a very basic use of R, such as the ifelse and aggregate functions. Try reading [1] for suggestions on clarifying your problem statement and follow up. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On December 18, 2014 1:23:09 AM PST, 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.
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.