Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/library/base/R/version.R
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ function(..., na.rm)
y
}
else
# Subscripting with 1L ensures the result is NA with length 0 input.
switch(.Generic,
max = x[which(v == max(v))[1L]],
min = x[which(v == min(v))[1L]],
range = x[c(which(v == min(v))[1L],
which(v == max(v))[1L])])
max = x[which.max(v)[1L]],
min = x[which.min(v)[1L]],
range = x[c(which.min(v)[1L], which.max(v)[1L])])
}

as.character.numeric_version <-
Expand Down
5 changes: 5 additions & 0 deletions tests/reg-tests-1e.R
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,11 @@ stopifnot(identical(format(x[,2]), c(NA_character_, "0")))
is.na(x)[1] <- TRUE; stopifnot(identical(is.na(x), c(TRUE, FALSE)))
## gave two spurious warnings in R <= 4.2.2

## NAs were not removed in R <= 4.5.2 (PR#19000)
x[3] <- "3.1"
stopifnot(identical(max(x, na.rm = TRUE), numeric_version("3.1")))
stopifnot(identical(min(x, na.rm = TRUE), numeric_version("2.0")))
stopifnot(identical(range(x, na.rm = TRUE), numeric_version(c("2.0", "3.1"))))

mChk <- function(m) stopifnot(exprs = {
identical(attributes(m), list(dim=2:3))
Expand Down