I am new to R and have learned how to geocode a specific address, but I would like to know if it is possible to geocode all pharmacies within a certain area without providing addresses. To start, I tried to geocode Walgreens within a specific zip code where only 1 Walgreens exists. I tried:
test = data.frame(geocode("walgreens, san juan, puerto rico, 00927", "all"))
It returned the location of the walgreens in that zip code. Then I tried a zip code that has 2 walgreens:
test2 = data.frame(geocode("walgreens, san juan, puerto rico, 00925", "all"))
This gives the error:
Error in data.frame(address_components = list(list(long_name = "Walgreens", : arguments imply differing number of rows: 2, 1, 5
Eventually, I would like to find x,y coordinates for all pharmacies within Puerto Rico. Is there a way to have it return multiple x,y coordinates when searching for 'walgreens', 'pharmacy' or other key words?