Skip to content

bug using tidyverse tibbles #53

@JorritMontijn

Description

@JorritMontijn

Hi! Thank you for building a great package. I'm not sure if anyone is still bugfixing issues, but even if not, then I hope the following will be useful for other users.

I am unsure what the exact source of this bug is, but I suspect it's a combination of an updated R version and using tibbles as data frames. When I run disparate_impact_remover(), I get the following error:


Error in `x[order(x, na.last = na.last, decreasing = decreasing)]`:
! Can't subset columns past the end.
ℹ Locations 383, 410, 435, …, 3673, and 4798 don't exist.
ℹ There is only 1 column.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In xtfrm.data.frame(x) : cannot xtfrm data frames

I've fixed this by turning the tibble's column into an array using the following subfunction:

get_group_data = function(data,protected,subgroup,feature) {
  #get subdata
  Y <- data[protected == subgroup, feature]
  
  #turn tibble/list into array
  return(Y[[feature]])
}

and replacing all lines where the to-be-repaired column was extracted from
Y <- data[protected == subgroup, feature]
into
Y <- get_group_data(data,protected,subgroup,feature)

I'm sure this bug is also present in other functions, but so far I've only used the disparate_impact_remover(). The fix is fairly simple, so I hope you have the time to update the package.

Thank you!

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