geolocation | R Documentation |
Convert the coordinates into formatted addresses
geolocation(data, longitude, latitude, ncore = 999)
data |
The dataset, a data.frame or data.table |
longitude |
The column having longitude |
latitude |
The column having latitude |
ncore |
The specific number of CPU cores used (ncore = 999 by default, which indicates the maximum of CPU cores minus 1 were used in parallel computing if your CPU is less than 999 cores) |
a data.table which adds the formatted address in the original data set.
The value of "longitude" or "latitude" should be digits in numeric or character format. If not, the function may return empty result for this coordinate automatically.
Amap. Official documents for developers: Web Service API. https://lbs.amap.com/api/webservice/summary
## Not run: library(amapR) options(amap.key = "xxxxxxxxxxxxxxxx") # Completed data test <- data.frame(n = 1:5000, lng = c(114.4345,104.0837), lat = c(30.51105, 30.63087)) results <- geolocation(data = test, longitude = "lng", latitude = "lat") # When the column 'lng' has missing value test <- data.frame(n = 1:5000, lng = c(114.4345,''), lat = c(30.51105, 30.63087)) results <- geolocation(data = test, longitude = "lng", latitude = "lat") # When the column 'lng' has special characters test <- data.frame(n = 1:5000, lng = c(114.4345,'?'), lat = c(30.51105, 30.63087)) results <- geolocation(data = test, longitude = "lng", latitude = "lat") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.