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

maintain tbl_df input #95

Merged
merged 1 commit into from
Nov 25, 2019
Merged

maintain tbl_df input #95

merged 1 commit into from
Nov 25, 2019

Conversation

mdsumner
Copy link
Contributor

@mdsumner mdsumner commented Nov 5, 2019

small change to ensure tibble-in, tibble-out

  f <- system.file("gpkg/nc.gpkg", package = "sf", mustWork = TRUE)

x <- sf::read_sf(f)
o <- rmapshaper::ms_simplify(x)
class(x)
#> [1] "sf"         "tbl_df"     "tbl"        "data.frame"
class(o)
#> [1] "sf"         "tbl_df"     "tbl"        "data.frame"

Created on 2019-11-06 by the reprex package (v0.3.0)

I'm motivated by this because I rely on the behaviour of tibble in several places, I don't think it can cause problems - the test for it's a tibble is very specific (could be made more general in future if needed).

The only difference is the class attribute, as in if you compare sf::st_as_sf(tibble::as_tibble(rmapshapher::ms_simplify(x))) with current behaviour, you get an identical object with this PR.

@ateucher ateucher merged commit f880580 into ateucher:master Nov 25, 2019
@ateucher
Copy link
Owner

Thanks @mdsumner, and sorry for the long wait!

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

Successfully merging this pull request may close these issues.

2 participants