coverage: Create a summary of the coverage between two dataframes

Description Usage Arguments Value Examples

Description

In the york building and york crime context, writing nearest(york_crime,york) reads as "find the nearest crime in york to each building in york, and returns a dataframe with every building in york, the nearest york_crime to each building, and the distance in metres between the two."

Usage

1
coverage(nearest_df, to_df, distance_cutoff = 100, ...)

Arguments

nearest_df

dataframe containing latitude and longitude

to_df

dataframe containing latitude and longitude

distance_cutoff

integer the distance threshold you are interested in assessing coverage at

...

extra arguments to pass to nearest

Value

a dataframe containing information about the distance threshold uses (distance_within), the number of events covered and not covered (n_cov, n_not_cov), the percentage covered and not covered (pct_cov, pct_not_cov), and the average distance and sd distance.

Examples

1
2
3
4
5
6
7
8
9
library(dplyr)

# already existing locations
york_selected <- york %>% filter(grade == "I")

# proposed locations
york_unselected <- york %>% filter(grade != "I")
coverage(york_selected, york_crime)
coverage(york_crime, york_selected)

njtierney/maxcovr documentation built on Nov. 13, 2019, 6:38 p.m.