smorgesboard: Calculates nearest drop box or polling location, Smorgesboard...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/smorgesboard.R

Description

Given a set of lat-long coordinates for each voter, and a set of coordinates for all drop boxes or polling locations; this function returns a dataframe length data1 (usually voter file), including haversine, mile, and kilometer distance output, as well as any other data2 variables (perhaps address).

Usage

1
smorgesboard(data1, data2 , lat_long1_char, lat_long2_char)

Arguments

data1

Dataset, probably a voter file, including lat/long coordinates

data2

Dataset, probably of drop box locations/polling locations, including lat/long coordinates

lat_long1_char

Character vector, latitude/longitude column names found in data1

lat_long2_char

Character vector, latitude/longitude column names found in data2

Value

A data frame of length data1, with all columns from data2 and distance_haversine, distance_mile, and distance_km appended.

Author(s)

Loren Collingwood <loren.collingwood@ucr.edu>

References

Haversine: CC Robusto, 1957

See Also

dist_km, dist_mile, nearest_dbox

Examples

1
2
3
4
5
6
7
data(meck_ev)
str(voter_meck)
str(early_meck)

# Grab smorgesboard of distance information from polling location
vote_distance <- smorgesboard(voter_meck, early_meck[,-1], c("lat", "long"), c("lat", "long"))
head(vote_distance)

Rvoterdistance documentation built on May 2, 2019, 2:08 p.m.