Interpolate inverse-distance-weighted measures for each x coordinate using measures taken at surrounding y coordinates. Ending measures are weighted by inverse distance so that surrounding measures taken in nearby areas are given more weight in final average.

dist_weighted_mean(x_df, y_df, measure_col, x_id = "id", x_lon_col = "lon",
  x_lat_col = "lat", y_lon_col = "lon", y_lat_col = "lat",
  dist_function = "Haversine", dist_transform = "level", decay = 2)

Arguments

x_df

DataFrame with coordinates that need weighted measures

y_df

DataFrame with coordinates at which measures were taken

measure_col

String name of measure column in y_df

x_id

String name of unique identifer column in x_df

x_lon_col

String name of column in x_df with longitude values

x_lat_col

String name of column in x_df with latitude values

y_lon_col

String name of column in y_df with longitude values

y_lat_col

String name of column in y_df with latitude values

dist_function

String name of distance function: "Haversine" (default) or "Vincenty"

dist_transform

String value of distance weight transform: "level" (default) or "log"

decay

Numeric value of distance weight decay: 2 (default)

Value

Dataframe of distance-weighted values