Skip to content

drop columns with nothing using @mutate?Β #116

@mistermichaelll

Description

@mistermichaelll

More @mutate testing fun πŸ˜„ this is more of a behavior question rather than a bug.

In dplyr, you can drop columns using mutate by passing NULL. This is news to me, and I actually only learned this from tests from the source code.

For example:

library(dplyr)
df <- tibble(x = 1, y = 2)
df |> mutate(y = NULL)

#> # A tibble: 1 Γ— 1
#>       x
#>   <dbl>
#> 1     1

In Tidier, I'd imagine that the closest behavior would be something like this:

using Tidier
using DataFrames
df = DataFrame(x = 1:3, y = 1:3)
@mutate(df, y = nothing)

But this doesn't drop the column, rather it just replaces y with a column of type nothing

3Γ—2 DataFrame
 Row β”‚ x      y       
     β”‚ Int64  Nothing 
─────┼────────────────
   1 β”‚     1          
   2 β”‚     2          
   3 β”‚     3          

Is dropping a column this way something that should be supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions