我很确定这是一个错误。请报告给软件包维护者。
如果我稍微更改的定义min.integer64
,它将正常工作:
assignInNamespace("min.integer64", function (..., na.rm = FALSE) { l <- list(...) ret <- double(1) noval <- TRUE if (length(l) == 1) { if (length(l[[1]])) noval <- FALSE .Call(bit64:::C_min_integer64, l[[1]], na.rm, ret) oldClass(ret) <- "integer64" } else { ret <- sapply(l, function(e) { if (length(e)) noval <<- FALSE if (is.integer64(e)) { ret <- double(1) #this was missing .Call(bit64:::C_min_integer64, e, na.rm, ret) ret } else { as.integer64(min(e, na.rm = na.rm)) } }) oldClass(ret) <- "integer64" ret <- min(ret, na.rm = na.rm) } if (noval) warning("no non-NA value, returning +9223372036854775807") ret }, pos = "package:bit64") min(x, y) #integer64 #[1] 200 min(y, x) #integer64 #[1] 200