Skip to content

Commit

Permalink
adjust checking input parameters for matchDim
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Jun 27, 2024
1 parent e2dc4ef commit 894ddba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions R/matchDim.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#' @param x a magclass object to be modified
#' @param ref a magclass object used as a reference for the modification
#' @param fill value to be set in new dimensions
#' @param dim subset of dimensions for which the matching should be done. Either number or
#' name of dimension or a vector of these. See \code{\link{dimCode}} for more details.
#' @param dim subset of dimensions for which the matching should be done.
#' Can be either a number between 1 and 3 or a vector of these.
#' Set to NULL (default) for matching all dimensions.
#' @author Falk Benke
#'
Expand All @@ -17,8 +17,8 @@ matchDim <- function(x, ref, dim = NULL, fill = NA) {

if (is.null(dim)) {
dim <- c(1, 2, 3)
} else {
dim <- dimCode(dim, x, missing = "stop")
} else if (length(setdiff(dim, c(1, 2, 3))) > 0) {
stop("argument 'dim' can only contain numbers between 1 and 3")
}

if (3 %in% dim && ndim(x, dim = 3) != ndim(ref, dim = 3)) {
Expand Down
4 changes: 2 additions & 2 deletions man/matchDim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 894ddba

Please sign in to comment.