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

bug using tidyverse tibbles #53

Open
JorritMontijn opened this issue Jan 22, 2025 · 0 comments
Open

bug using tidyverse tibbles #53

JorritMontijn opened this issue Jan 22, 2025 · 0 comments

Comments

@JorritMontijn
Copy link

JorritMontijn commented Jan 22, 2025

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!

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

1 participant