join_data: Join external data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/join_data.R

Description

A wrapper around dplyr's join in order to facilitate the analysis on the maps from this package

Usage

1
join_data(map, data, by = NULL)

Arguments

map

An object of class 'sf', 'SpatialPolygonsDataFrame' or 'data.frame'

data

A data.frame object with the data to join

by

A character vector of variables to join by. If NULL, the default, will do a natural join, using all variables with common names across the two tables. See dplyr's join to more information.

Value

The function returns a 'sf', 'SpatialPolygonsDataFrame' or 'data.frame' object depending of the class of the map argument informed

Author(s)

Renato Prado Siqueira <rpradosiqueira@gmail.com>

See Also

get_brmap

Examples

1
2
3
4
5
6
# Joining population estimates data to the year of 2017
data("pop2017")
municipios <- get_brmap(geo = "City", geo.filter = list(Region = 5),
                        class = "SpatialPolygonsDataFrame")

municipios <- join_data(municipios, pop2017, by = c("City" = "mun"))

brazilmaps documentation built on May 2, 2019, 3:04 a.m.