Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with get_brmap function #2

Open
cgu-dados opened this issue Jun 27, 2019 · 1 comment
Open

Problems with get_brmap function #2

cgu-dados opened this issue Jun 27, 2019 · 1 comment

Comments

@cgu-dados
Copy link

cgu-dados commented Jun 27, 2019

Hi,

Seens like the sp package changed the function as(obj, "Spatial"). Now, the synthax is as_Spatial(obj).

I will be glad if you fix the function!

=]

Current code:
if (class == "SpatialPolygonsDataFrame") brmap <- as(brmap, "Spatial") if (class == "data.frame") brmap <- as(brmap, "Spatial") %>% ggplot2::fortify(region = geo)

New code:
if (class == "SpatialPolygonsDataFrame") brmap <- sf::as_Spatial(brmap) if (class == "data.frame") brmap <- sf::as_Spatial(brmap) %>% ggplot2::fortify(region = geo)

@cgu-dados cgu-dados changed the title Problems with get_map function Problems with get_brmap function Jun 27, 2019
@deltalite
Copy link

I believe this is a consequence of the sf package function change, but prior to calling get_brmap make sure you load the package sf.

library(brazilmaps)
library(sf)
map_states <- get_brmap(geo = "State", class = "sf")
plot_brmap(map_states)

It would be best if this is fixed in the package as above to help users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants