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

drop_na() loses extra classes for tbl_dfs #1556

Closed
d-morrison opened this issue Jul 17, 2024 · 1 comment
Closed

drop_na() loses extra classes for tbl_dfs #1556

d-morrison opened this issue Jul 17, 2024 · 1 comment

Comments

@d-morrison
Copy link

When I add a subclass to a tbl_df, drop_na() removes that class:

iris |> 
  dplyr::as_tibble() |> 
  structure(class = c("pop_data", "tbl_df", "tbl", "data.frame")) |>  
  tidyr::drop_na()  |>   
  class()
#> [1] "tbl_df"     "tbl"        "data.frame"

In contrast, it doesn't remove subclasses from data.frames:

iris |> 
  structure(class = c("pop_data", "data.frame")) |>  
  tidyr::drop_na() |>   
  class()
#> [1] "pop_data"   "data.frame"

Created on 2024-07-17 with reprex v2.1.0

@DavisVaughan
Copy link
Member

This is a specific case of #943

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