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

Add unnest method for sf class #570

Merged
merged 2 commits into from
Dec 3, 2017
Merged

Add unnest method for sf class #570

merged 2 commits into from
Dec 3, 2017

Conversation

karldw
Copy link
Contributor

@karldw karldw commented Nov 27, 2017

Changes:

  • Create unnest.sf method, automatically adding the geometry column(s) to the list of list columns that will not be unnested.
  • Add tests.
  • Increase suggested version of tidyr to > 0.7.2 to be able to use .preserve. (Note, the CRAN and Github versions are both at 0.7.2, so the tests currently fail.)
  • Unindent a few lines in gather.sf and spread.sf for clearer expression (not part of if block).
  • Auto-remove a bunch of trailing spaces.

Do you want to hold off merging this until tidyr does a release?

- Create unnest.sf method, automatically adding the geometry column(s)
  to the list of list columns that will *not* be unnested.
- Add tests.
- Increase suggested version of tidyr to > 0.7.2.
@karldw
Copy link
Contributor Author

karldw commented Nov 29, 2017

Update: this should work with the development version of tidyr now.

nc = st_transform(nc[1:3,], 3857)
st_agr(nc) = "constant"
expect_is(nc, "tbl_df")
expect_is(st_intersection(nc[1:3], nc[4:6]), "tbl_df")
})

test_that("unnest works", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you would make the test conditional on the tidyr version, it might pass tests and could be merged now.

RSQLite,
RPostgreSQL,
tibble,
rlang,
dplyr (>= 0.7-0),
tidyr (>= 0.7-1),
tidyr (> 0.7-2),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be left as it was, here.

@edzer edzer merged commit b2e7a58 into r-spatial:master Dec 3, 2017
@edzer
Copy link
Member

edzer commented Dec 3, 2017

Thanks! This is now ignored with CRAN versions; FYI I tried testing with tidyverse GH versions of tidyr, tidyselect and rlang, but that broke on rename, for reasons probably not caused here.

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