Learn R Programming

endorse (version 1.6.2)

GeoId: Getting Indices of Incidents around a specified point

Description

This function obtains the indices of incidents within a specified distance around a specified point.

Usage

GeoId(x, y, distance, x.latitude = "latitude",
      x.longitude = "longitude", y.latitude = "latitude",
      y.longitude = "longitude")

Arguments

x

data frame containing the longitude and the latitude of a point.

y

data frame containing the longitude and the latitude of incidents.

distance

numeric. The distance from villages in kilometers.

x.latitude

character. The variable name for the latitude in x.

x.longitude

character. The variable name for the longitude in x.

y.latitude

character. The variable name for the latitude in y.

y.longitude

character. The variable name for the longitude in y.

Value

A vector containing the indices of y that are within distance kilometers around the point specified by x. If there are multiple observations in x, the first row is used as the point.