Skip to content

Commit

Permalink
Merge pull request #1975 from gregleleu/tidyr-drop-na
Browse files Browse the repository at this point in the history
Tidyr drop na
  • Loading branch information
edzer authored Jul 18, 2022
2 parents 36a6767 + d233726 commit 4e58722
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 10 additions & 0 deletions R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,15 @@ pillar_shaft.sfc <- function(x, ...) {
pillar::new_pillar_shaft_simple(out, align = "right", min_width = 25)
}

#' @name tidyverse
drop_na.sf <- function(x, ...) {
sf_column_name = attr(x, "sf_column")
class(x) <- setdiff(class(x), "sf")
st_as_sf(NextMethod(), sf_column_name = sf_column_name)
}



#nocov start
register_all_s3_methods = function() {
has_dplyr_1.0 =
Expand Down Expand Up @@ -631,6 +640,7 @@ register_all_s3_methods = function() {
register_s3_method("tidyr", "separate_rows", "sf")
register_s3_method("tidyr", "unite", "sf")
register_s3_method("tidyr", "unnest", "sf")
register_s3_method("tidyr", "drop_na", "sf")
register_s3_method("pillar", "obj_sum", "sfc")
register_s3_method("pillar", "type_sum", "sfc")
register_s3_method("pillar", "pillar_shaft", "sfc")
Expand Down
9 changes: 4 additions & 5 deletions man/tidyverse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e58722

Please sign in to comment.