Skip to content

setdiff vs. setequal inconsitency when columns have different types #6114

Description

@sigmaeon

It seems like setequal compares column types while setdiff doesn't.

df1 <- data.frame(x=1)
df2 <- df1

# df1$x and df2$x are both of type `num`
setdiff(df1, df2) # --> will output 0-rowed data.frame
setequal(df1, df2) # --> will output TRUE

df2$x %<>% as.integer 

# df1$x is of type `num` while df2$x is of type `int`
setdiff(df1, df2) # --> will output 0-rowed data.frame
setequal(df1, df2) # --> will output FALSE

I can see how this could actually be the intended behavior.
However, in that case a hint in the docs would be great.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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