Uses spatial comparison to determine which polygons the locations fall into and returns the variable associated with those polygons.
If allData = TRUE, the entire dataframe is returned.
allData = TRUE
getVariable(lon, lat, dataset = NULL, variable = NULL, countryCodes = NULL, allData = FALSE)
vector of longitudes in decimal degrees
vector of latitudes in decimal degrees
name of spatial dataset to use
name of dataframe column to be returned
vector of countryCodes
logical specifying whether a full dataframe should be returned
Vector or dataframe.
getSpatialData
# NOT RUN { loadSpatialData("NaturalEarthAdm1") lon <- seq(0, 50) lat <- seq(0, 50) getVariable(lon, lat, "NaturalEarthAdm1", "gns_lang") # }
Run the code above in your browser using DataLab