geo_join: Easily merge a data frame to a spatial data frame
Description
The pages of StackOverflow are littered with questions about how to merge a regular data frame to a
spatial data frame in R. The merge function from the sp package operates under a strict set of
assumptions, which if violated will break your data. This function wraps a couple StackOverflow answers
I've seen that work in a friendlier syntax.Usage
geo_join(spatial_data, data_frame, by_sp, by_df)
Arguments
spatial_data
A spatial data frame to which you want to merge data.
data_frame
A regular data frame that you want to merge to your spatial data.
by_sp
The column name you'll use for the merge from your spatial data frame.
by_df
The column name you'll use for the merge from your regular data frame.
Value
- a
SpatialXxxDataFrame object