Skip to content

drop_na() with an empty selection shouldn't be the same as no selectionΒ #1227

@DavisVaughan

Description

@DavisVaughan
library(tidyr)

df <- data.frame(x=c(1, NA, 2),y=c(NA, 1, 2))

# People like to use drop_na() like this
# (uses all columns)
drop_na(df)
#>   x y
#> 1 2 2

# But this currently also resolves to "use all columns"
# when really it should be "don't use any columns"
drop_na(df, starts_with("foo"))
#>   x y
#> 1 2 2

Created on 2021-11-19 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions