From 52c66fc5c229ec1ed27c86dfc4e60a5daf386af5 Mon Sep 17 00:00:00 2001 From: Michaja Pehl Date: Tue, 28 May 2024 12:40:43 +0200 Subject: [PATCH] Sacrifice at the altar of all-mighty lintr! --- R/mbind.R | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/R/mbind.R b/R/mbind.R index bb4eaba..dad96b0 100644 --- a/R/mbind.R +++ b/R/mbind.R @@ -76,46 +76,46 @@ mbind <- function(...) { #nolint " data objects! Cannot handle this case!") } - diffall <- c('spatial' = diffspat, 'temporal' = difftemp, 'data' = diffdata) + diffall <- c("spatial" = diffspat, "temporal" = difftemp, "data" = diffdata) if (1 < sum(diffall)) { msg <- c("Cannot handle objects!", - paste( - paste(head(names(diffall)[diffall], n = -1), - collapse = ", "), - tail(names(diffall)[diffall], n = 1), - sep = " as well as "), + paste(paste(head(names(diffall)[diffall], n = -1), + collapse = ", "), + tail(names(diffall)[diffall], n = 1), + sep = " as well as "), "dimensions differ!") substr(msg[2], 1, 1) <- toupper(substr(msg[2], 1, 1)) - msg <- paste( - c(paste(msg, collapse = " "), - " Differences from first mbind() input:", - vapply(which(diffall), function(i) { + msg <- paste(c(paste(msg, collapse = " "), + " Differences from first mbind() input:", + vapply(which(diffall), function(i) { - lhs <- getItems(inputs[[1]], dim = i) - rhs <- Reduce(union, lapply(tail(inputs, n = -1), getItems, dim = i)) + lhs <- getItems(inputs[[1]], dim = i) + rhs <- Reduce(union, lapply(tail(inputs, n = -1), + getItems, dim = i)) - # do a kind of three-way diff - diff <- list('missing' = setdiff(lhs, rhs), - ' having' = intersect(lhs, rhs), - ' adding' = setdiff(rhs, lhs)) + # do a kind of three-way diff + diff <- list("missing" = setdiff(lhs, rhs), + " having" = intersect(lhs, rhs), + " adding" = setdiff(rhs, lhs)) - diff <- lapply(diff, function(x) { - if (4 < length(x)) { # shorten to four elements, like str() does - x <- c(paste0("`", x[1:4], "`"), "...") - } else if (0 < length(x)) { - x <- paste0("`", x, "`") - } - return(paste(x, collapse = ", ")) - }) + diff <- lapply(diff, function(x) { + if (4 < length(x)) { + # shorten to four elements, like str() does + x <- c(paste0("`", x[1:4], "`"), "...") + } else if (0 < length(x)) { + x <- paste0("`", x, "`") + } + return(paste(x, collapse = ", ")) + }) - # paste diff - d <- nzchar(diff) - paste(c(paste0(" ", names(diffall)[i], ":"), - paste(paste0(" ", names(diff)[d], ":"), diff[d])), - collapse = "\n") - }, character(1))), - collapse = "\n") + # paste diff + d <- nzchar(diff) + paste(c(paste0(" ", names(diffall)[i], ":"), + paste(paste0(" ", names(diff)[d], ":"), + diff[d])), + collapse = "\n") + }, character(1))), collapse = "\n") stop(msg) }