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

Cols hide missing #1152

Closed
wants to merge 5 commits into from
Closed

Cols hide missing #1152

wants to merge 5 commits into from

Conversation

mrcaseb
Copy link

@mrcaseb mrcaseb commented Dec 1, 2022

Summary

This PR introduces the exported function cols_hide_missing(). It checks if columns in the table data are missing all rows, i.e. all values equal NA, and hides them using cols_hide().

It is obviously possible to omit such columns before entering gt but the "all-NA" columns could still be useful during formatting of other columns.

I keep the PR a draft as the cols_hide documentation needs to be updated for cols_hide_missing. I didn't do this yet because I wanted to discuss the general interest in this function first.

Checklist

@CLAassistant
Copy link

CLAassistant commented Dec 1, 2022

CLA assistant check
All committers have signed the CLA.

@rich-iannone
Copy link
Member

Thanks for the contribution but after thinking about this for some time, it's possible to create an equivalent tidyselect expression and supply it to cols_hide() for the same effect.

@mrcaseb
Copy link
Author

mrcaseb commented May 18, 2024

Thanks for the contribution but after thinking about this for some time, it's possible to create an equivalent tidyselect expression and supply it to cols_hide() for the same effect.

Oooh. I never thought about that! Do you suggest something like this?

tidyselect::where(~ all(is.na(.x)))

@mrcaseb mrcaseb deleted the cols-hide-missing branch May 18, 2024 19:18
@rich-iannone
Copy link
Member

Yeah, that would do it! Again sorry to close but it’s in the interest of limiting new functions (as we are super high in exported function count now).

@mrcaseb
Copy link
Author

mrcaseb commented May 18, 2024

Yeah, that would do it! Again sorry to close but it’s in the interest of limiting new functions (as we are super high in exported function count now).

Oh no worries. I prefer limiting exported functions as well and appreciate the tidyselect suggestion as well as your work.

olivroy added a commit to olivroy/gt that referenced this pull request May 19, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants