Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 5, 2024
1 parent 0e6b167 commit 26dd3d4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/utils_compact.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
#' @export
compact_list <- function(x, remove_na = FALSE) {
# to make regular(!) R code work with vctrs, we need to remove the vctrs-class
x <- .clean_from_vctrs(x)
# x <- .clean_from_vctrs(x)
# finally, we can compact the list...
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)) || all(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)) || all(is.na(i)) || all(vapply(i, is.null, logical(1))) || any(vapply(i, function(j) length(j) == 1 && is.character(j) && j == "NULL", logical(1)), na.rm = TRUE)))]

Check warning on line 16 in R/utils_compact.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_compact.R,line=16,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 315 characters.
# 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)) || all(is.na(i)) || any(i == "NULL", na.rm = TRUE)))]

Check warning on line 17 in R/utils_compact.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_compact.R,line=17,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 206 characters.
} 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) || all(vapply(i, is.null, logical(1))) || any(vapply(i, function(j) length(j) == 1 && is.character(j) && j == "NULL", logical(1)), na.rm = TRUE)))]

Check warning on line 19 in R/utils_compact.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_compact.R,line=19,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 265 characters.
# 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)))]

Check warning on line 20 in R/utils_compact.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/utils_compact.R,line=20,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 156 characters.
}
}

Expand Down

0 comments on commit 26dd3d4

Please sign in to comment.