Description Usage Arguments Value Author(s) Examples
For a selected point in x-y (decilmal long-lat) coordinates, subset and summarise points found in an specified radius.
1 | urban_context(x, y, data, df.x = "x", df.y = "y", variable = "variable", radius = 1, FUN, empty.value = 0)
|
x |
Longitude coordinates in decimal degrees for the reference point. |
y |
Latitude coordinates in decimal degrees for the reference point. |
data |
data.frame with the observations that will be sumarised. This data.frame should have at least three columns: x, y, and variable. |
df.x |
Name of the column in the dataframe which includes the longitude coordinates in decimal degrees for each observation. |
df.y |
Name of the column in the dataframe which includes the latitude coordinates in decimal degrees for each observation. |
variable |
Name of the column in the dataframe "data", which includes the values to be summarised. |
radius |
Search radius in kilometers of the circunference with center in x, y. Default is set to 1 km. |
FUN |
Function to be applied. |
empty.value |
What to return if no point are found. Default is set to 0. |
A numeric value: the result of applying the function "FUN" to the column "variable", from a subset of "data". The subset includes all observations where the distance between (x, y) and (df.x, df.y) is less or equal than the distance defined by "radius".
Ricardo Ochoa Sosa
1 2 3 4 5 6 7 8 9 10 11 12 13 | my.data <-
read.table(header = TRUE, text = "
x y variable
-99.495 19.16 1
-99.490 19.16 5
-99.500 19.14 2
-99.490 19.15 10
")
urban_context(x = -99.490,
y = 19.16,
data = my.data,
FUN = mean)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.