I have a dataframe from almost all zipcodes of Germany.
# German Zip
Germany <- read.csv("https://gist.githubusercontent.com/MarcoKuehne/a012325ef8a9fa33aaa943dbc3db4ba9/raw/8616404bece8d405553d36380c7242fab37043d9/zipcodes.germany.csv", sep = ";")
head(Germany)
id loc_id zipcode name lat lon
1 1 14308 19348 Berge bei Perleberg 53.23746 11.870770
2 2 22537 85309 Pörnbach 48.61670 11.466700
3 3 106968 24790 Osterrönfeld Heidkrug, Gemeinde Osterrönfeld 54.27536 9.737535
4 4 18324 98646 Hildburghausen 50.43950 10.723922
5 5 16590 27336 Frankenfeld, Aller 52.76951 9.430780
6 6 19092 19294 Karenz 53.23012 11.343840
and a dataframe of particular places/locations in Germany, e.g. blood donation center, both with their respective longitude and latitude information:
# German Blood Donation
Blooddonation <- read.csv("https://gist.githubusercontent.com/MarcoKuehne/95cc459b81f2bc6bec2f2b46d1f6273a/raw/2b1c77fe5cf1203ca105b7f61019bb390335db8e/LocationsUpdate.csv", sep=",")
head(Blooddonation)
title zip lat lon
1 Haema Blutspendezentrum Dresden-World Trade Center 01067 51.04807 13.7238
2 Octapharma Plasmaspende Dresden 01067 51.04932 13.73557
3 Haema Dresden Elbepark 01139 51.08232 13.696
4 DRK-Blutspendedienst Dresden 01307 51.05294 13.78027
5 Haema Blutspendezentrum Dresden-Fetscherplatz 01307 51.04654 13.77047
6 Haema Blutspendezentrum Görlitz 02826 51.15275 14.98878
How can I find the number of neighbour locations (blood donation centers) within a radius of e.g. 10km, 20km from each zipcode in Germany and store the result as a variable in my Germany
dataframe.
Is there a tidyverse
(tidy) solution such that the results are stored as variable in a dataframe?