Created
June 26, 2026 17:28
-
-
Save benjamin-chan/5c9c8dc3c66436de1978cd4496ea2ebc to your computer and use it in GitHub Desktop.
R function to select rows in a data frame whose columns are not all NA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Function to select rows in a data frame whose columns are not all NA | |
| selectNotAllNA <- function(data) { | |
| require(dplyr) | |
| require(tidyselect) | |
| foo <- function(x) {any(!is.na(x))} | |
| data |> select(where(foo)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment