Skip to content

Commit

Permalink
Update utils_compact.R
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 3, 2022
1 parent 863c461 commit 8de4c03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/utils_compact.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#' @export
compact_list <- function(x, remove_na = FALSE) {
if (remove_na) {
x[!sapply(x, function(i) !is_model(i) && !inherits(i, c("Formula", "gFormula")) && (length(i) == 0L || is.null(i) || (length(i) == 1L & is.na(i)) || any(i == "NULL", na.rm = TRUE)))]
x[!sapply(x, function(i) !is_model(i) && !inherits(i, c("Formula", "gFormula")) && (length(i) == 0L || is.null(i) || (length(i) == 1L & is.na(i)) || identical(as.character(stats::na.omit(i)), "NULL")))]
} else {
x[!sapply(x, function(i) !is_model(i) && !inherits(i, c("Formula", "gFormula")) && (length(i) == 0L || is.null(i) || any(i == "NULL", na.rm = TRUE)))]
x[!sapply(x, function(i) !is_model(i) && !inherits(i, c("Formula", "gFormula")) && (length(i) == 0L || is.null(i) || identical(as.character(stats::na.omit(i)), "NULL")))]
}
}

Expand Down

0 comments on commit 8de4c03

Please # to comment.