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
2 changes: 1 addition & 1 deletion src/library/base/R/apply.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ apply <- function(X, MARGIN, FUN, ..., simplify = TRUE)

if (is.character(MARGIN)) {
if(is.null(dnn <- names(dn))) # names(NULL) is NULL
stop("'X' must have named dimnames")
stop(gettextf("'%s' must have named dimnames", "X"), domain=NA)

MARGIN <- match(MARGIN, dnn)
if (anyNA(MARGIN))
Expand Down
4 changes: 2 additions & 2 deletions src/library/base/R/array.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function(x, MARGIN)
if (is.character(MARGIN)) {
dn <- dimnames(x)
if(is.null(dnn <- names(dn))) # names(NULL) is NULL
stop("'x' must have named dimnames")
stop(gettextf("'%s' must have named dimnames", "x"), domain=NA)
MARGIN <- match(MARGIN, dnn)
if (anyNA(MARGIN))
stop("not all elements of 'MARGIN' are names of dimensions")
Expand Down Expand Up @@ -128,7 +128,7 @@ function(x, MARGIN, drop = FALSE)

if (is.character(MARGIN)) {
if(is.null(dnn <- names(dn))) # names(NULL) is NULL
stop("'x' must have named dimnames")
stop(gettextf("'%s' must have named dimnames", "x"), domain=NA)
MARGIN <- match(MARGIN, dnn)
if (anyNA(MARGIN))
stop("not all elements of 'MARGIN' are names of dimensions")
Expand Down
2 changes: 1 addition & 1 deletion src/library/base/R/attach.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ detach <- function(name, pos = 2L, unload = FALSE, character.only = FALSE,
if (!is.character(name)) name <- deparse1(name)
match(name, search())
}
if(is.na(pos)) stop("invalid 'name' argument")
if(is.na(pos)) stop(gettextf("invalid '%s' argument", "name"), domain=NA)
}

packageName <- search()[[pos]]
Expand Down
8 changes: 4 additions & 4 deletions src/library/base/R/colSums.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ colSums <- function(x, na.rm = FALSE, dims = 1L)
if(!is.array(x) || length(dn <- dim(x)) < 2L)
stop("'x' must be an array of at least two dimensions")
if(length(dims) != 1L || dims < 1L || dims > length(dn) - 1L)
stop("invalid 'dims'")
stop(gettextf("invalid '%s'", "dims"), domain=NA)
n <- prod(dn[id <- seq_len(dims)])
dn <- dn[-id]
z <- .Internal(colSums(x, n, prod(dn), na.rm))
Expand All @@ -43,7 +43,7 @@ colMeans <- function(x, na.rm = FALSE, dims = 1L)
if(!is.array(x) || length(dn <- dim(x)) < 2L)
stop("'x' must be an array of at least two dimensions")
if(length(dims) != 1L || dims < 1L || dims > length(dn) - 1L)
stop("invalid 'dims'")
stop(gettextf("invalid '%s'", "dims"), domain=NA)
n <- prod(dn[id <- seq_len(dims)])
dn <- dn[-id]
z <- .Internal(colMeans(x, n, prod(dn), na.rm))
Expand All @@ -60,7 +60,7 @@ rowSums <- function(x, na.rm = FALSE, dims = 1L)
if(!is.array(x) || length(dn <- dim(x)) < 2L)
stop("'x' must be an array of at least two dimensions")
if(length(dims) != 1L || dims < 1L || dims > length(dn) - 1L)
stop("invalid 'dims'")
stop(gettextf("invalid '%s'", "dims"), domain=NA)
p <- prod(dn[-(id <- seq_len(dims))])
dn <- dn[id]
z <- .Internal(rowSums(x, prod(dn), p, na.rm))
Expand All @@ -77,7 +77,7 @@ rowMeans <- function(x, na.rm = FALSE, dims = 1L)
if(!is.array(x) || length(dn <- dim(x)) < 2L)
stop("'x' must be an array of at least two dimensions")
if(length(dims) != 1L || dims < 1L || dims > length(dn) - 1L)
stop("invalid 'dims'")
stop(gettextf("invalid '%s'", "dims"), domain=NA)
p <- prod(dn[-(id <- seq_len(dims))])
dn <- dn[id]
z <- .Internal(rowMeans(x, prod(dn), p, na.rm))
Expand Down
4 changes: 2 additions & 2 deletions src/library/base/R/connections.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ readBin <- function(con, what, n = 1L, size = NA_integer_, signed = TRUE,
endian = .Platform$endian)
{
if (!endian %in% c("big", "little", "swap"))
stop("invalid 'endian' argument")
stop(gettextf("invalid '%s' argument", "endian"), domain=NA)
if(is.character(con)) {
con <- file(con, "rb")
on.exit(close(con))
Expand All @@ -281,7 +281,7 @@ writeBin <-
useBytes = FALSE)
{
if (!endian %in% c("big", "little", "swap"))
stop("invalid 'endian' argument")
stop(gettextf("invalid '%s' argument", "endian"), domain=NA)
swap <- endian != .Platform$endian
if(!is.vector(object) || mode(object) == "list")
stop("can only write vector objects")
Expand Down
12 changes: 6 additions & 6 deletions src/library/base/R/dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ summary.Date <- function(object, digits = 12L, ...)
if (nargs() == 1L) return(e1)
# only valid if one of e1 and e2 is a scalar.
if(inherits(e1, "Date") && inherits(e2, "Date"))
stop("binary + is not defined for \"Date\" objects")
stop(gettextf("binary '%s' is not defined for \"%s\" objects", "+", "Date"), domain=NA)
if (inherits(e1, "difftime")) e1 <- coerceTimeUnit(e1)
if (inherits(e2, "difftime")) e2 <- coerceTimeUnit(e2)
.Date(unclass(e1) + unclass(e2))
Expand All @@ -169,7 +169,7 @@ summary.Date <- function(object, digits = 12L, ...)
days = x, weeks = 7*x)))
if(!inherits(e1, "Date"))
stop("can only subtract from \"Date\" objects")
if (nargs() == 1L) stop("unary - is not defined for \"Date\" objects")
if (nargs() == 1L) stop(gettextf("unary '%s' is not defined for \"%s\" objects", "-", "Date"), domain=NA)
if(inherits(e2, "Date")) return(difftime(e1, e2, units="days"))
if (inherits(e2, "difftime")) e2 <- coerceTimeUnit(e2)
if(!is.null(attr(e2, "class")))
Expand All @@ -180,13 +180,13 @@ summary.Date <- function(object, digits = 12L, ...)
Ops.Date <- function(e1, e2)
{
if (nargs() == 1L)
stop(gettextf("unary %s not defined for \"Date\" objects", .Generic),
stop(gettextf("unary '%s' is not defined for \"%s\" objects", .Generic, "Date"),
domain = NA)
boolean <- switch(.Generic, "<" =, ">" =, "==" =,
"!=" =, "<=" =, ">=" = TRUE,
FALSE)
if (!boolean)
stop(gettextf("%s not defined for \"Date\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "Date"),
domain = NA)
## allow character args to be coerced to dates
if (is.character(e1)) e1 <- as.Date(e1)
Expand All @@ -195,13 +195,13 @@ Ops.Date <- function(e1, e2)
}

Math.Date <- function (x, ...)
stop(gettextf("%s not defined for \"Date\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "Date"),
domain = NA)

Summary.Date <- function (..., na.rm)
{
ok <- switch(.Generic, max = , min = , range = TRUE, FALSE)
if (!ok) stop(gettextf("%s not defined for \"Date\" objects", .Generic),
if (!ok) stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "Date"),
domain = NA)
.Date(NextMethod(.Generic), oldClass(..1))
}
Expand Down
26 changes: 13 additions & 13 deletions src/library/base/R/datetime.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ summary.POSIXlt <- function(object, digits = 15, ...)
if (nargs() == 1L) return(e1)
# only valid if one of e1 and e2 is a scalar/difftime
if(inherits(e1, "POSIXt") && inherits(e2, "POSIXt"))
stop("binary '+' is not defined for \"POSIXt\" objects")
stop(gettextf("binary '%s' is not defined for \"%s\" objects", "+", "POSIXt"), domain=NA)
if(inherits(e1, "POSIXlt")) e1 <- as.POSIXct(e1)
if(inherits(e2, "POSIXlt")) e2 <- as.POSIXct(e2)
if (inherits(e1, "difftime")) e1 <- coerceTimeUnit(e1)
Expand All @@ -501,7 +501,7 @@ summary.POSIXlt <- function(object, digits = 15, ...)
days = 60*60*24*x, weeks = 60*60*24*7*x))
if(!inherits(e1, "POSIXt"))
stop("can only subtract from \"POSIXt\" objects")
if (nargs() == 1L) stop("unary '-' is not defined for \"POSIXt\" objects")
if (nargs() == 1L) stop(gettextf("unary '%s' is not defined for \"%s\" objects", "-", "POSIXt"), domain=NA)
if(inherits(e2, "POSIXt")) return(difftime(e1, e2))
if (inherits(e2, "difftime")) e2 <- coerceTimeUnit(e2)
if(!is.null(attr(e2, "class")))
Expand All @@ -513,12 +513,12 @@ summary.POSIXlt <- function(object, digits = 15, ...)
Ops.POSIXt <- function(e1, e2)
{
if (nargs() == 1L)
stop(gettextf("unary '%s' not defined for \"POSIXt\" objects",
.Generic), domain = NA)
stop(gettextf("unary '%s' is not defined for \"%s\" objects",
.Generic, "POSIXt"), domain = NA)
boolean <- switch(.Generic, "<" = , ">" = , "==" = ,
"!=" = , "<=" = , ">=" = TRUE, FALSE)
if (!boolean)
stop(gettextf("'%s' not defined for \"POSIXt\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "POSIXt"),
domain = NA)
if(inherits(e1, "POSIXlt") || is.character(e1)) e1 <- as.POSIXct(e1)
if(inherits(e2, "POSIXlt") || is.character(e2)) e2 <- as.POSIXct(e2)
Expand All @@ -528,7 +528,7 @@ Ops.POSIXt <- function(e1, e2)

Math.POSIXt <- function (x, ...)
{
stop(gettextf("'%s' not defined for \"POSIXt\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "POSIXt"),
domain = NA)
}

Expand All @@ -552,7 +552,7 @@ Summary.POSIXct <- function (..., na.rm, finite = FALSE)
{
ok <- switch(.Generic, max = , min = , range = TRUE, FALSE)
if (!ok)
stop(gettextf("'%s' not defined for \"POSIXt\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "POSIXt"),
domain = NA)
args <- list(...)
tz <- do.call(.check_tzones, args)
Expand All @@ -563,7 +563,7 @@ Summary.POSIXlt <- function (..., na.rm, finite = FALSE)
{
ok <- switch(.Generic, max = , min = , range = TRUE, FALSE)
if (!ok)
stop(gettextf("'%s' not defined for \"POSIXt\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "POSIXt"),
domain = NA)
args <- list(...)
tz <- do.call(.check_tzones, args)
Expand Down Expand Up @@ -814,8 +814,8 @@ Ops.difftime <- function(e1, e2)
}
if (nargs() == 1L) {
switch(.Generic, "+" = {}, "-" = {e1[] <- -unclass(e1)},
stop(gettextf("unary '%s' not defined for \"difftime\" objects",
.Generic), domain = NA, call. = FALSE)
stop(gettextf("unary '%s' is not defined for \"%s\" objects",
.Generic, "difftime"), domain = NA, call. = FALSE)
)
return(e1)
}
Expand Down Expand Up @@ -845,7 +845,7 @@ Ops.difftime <- function(e1, e2)
}
} else {
## '*' is covered by a specific method
stop(gettextf("'%s' not defined for \"difftime\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "difftime"),
domain = NA)
}
}
Expand Down Expand Up @@ -877,7 +877,7 @@ Math.difftime <- function (x, ...)
.difftime(NextMethod(), units)
},
### otherwise :
stop(gettextf("'%s' not defined for \"difftime\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "difftime"),
domain = NA))
}

Expand All @@ -896,7 +896,7 @@ Summary.difftime <- function (..., na.rm)
}
ok <- switch(.Generic, max = , min = , sum=, range = TRUE, FALSE)
if (!ok)
stop(gettextf("'%s' not defined for \"difftime\" objects", .Generic),
stop(gettextf("'%s' is not defined for \"%s\" objects", .Generic, "difftime"),
domain = NA)
x <- list(...)
Nargs <- length(x)
Expand Down
2 changes: 1 addition & 1 deletion src/library/base/R/eigen.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ eigen <- function(x, symmetric, only.values = FALSE, EISPACK = FALSE)
if (n != ncol(x)) stop("non-square matrix in 'eigen'")
if (!n) stop("0 x 0 matrix")
n <- as.integer(n)
if(is.na(n)) stop("invalid nrow(x)")
if(is.na(n)) stop(gettextf("invalid %s", "nrow(x)"), domain=NA)

complex.x <- is.complex(x)
if (!all(is.finite(x))) stop("infinite or missing values in 'x'")
Expand Down
4 changes: 2 additions & 2 deletions src/library/base/R/files.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ normalizePath <- function(path, winslash = "\\", mustWork = NA)
Sys.setFileTime <- function(path, time)
{
if (!is.character(path))
stop("invalid 'path' argument")
stop(gettextf("invalid '%s' argument", "path"), domain=NA)
time <- as.POSIXct(time)
if (anyNA(time)) stop("invalid 'time' argument")
if (anyNA(time)) stop(gettextf("invalid '%s' argument", "time"), domain=NA)
.Internal(setFileTime(path, time))
}
2 changes: 1 addition & 1 deletion src/library/base/R/kappa.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ kappa.qr <- function(z, ...)
}
else {
p <- as.integer(nrow(z))
if(is.na(p)) stop("invalid nrow(z)")
if(is.na(p)) stop(gettextf("invalid %s", "nrow(z)"), domain=NA)
if(p != ncol(z)) stop("triangular matrix should be square")
if(is.null(norm)) norm <- "1"
else if(norm == "2") {
Expand Down
4 changes: 2 additions & 2 deletions src/library/base/R/library.R
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ function(chname, package, lib.loc, verbose = getOption("verbose"),
message(gettextf("DLL %s already loaded", sQuote(chname1)),
domain = NA)
else
message(gettextf("shared object '%s' already loaded",
message(gettextf("shared object %s already loaded",
sQuote(chname1)), domain = NA)
return(invisible(dll_list[[ seq_along(dll_list)[ind] ]]))
}
Expand Down Expand Up @@ -659,7 +659,7 @@ function(chname, libpath, verbose = getOption("verbose"),
if(.Platform$OS.type == "windows")
stop(gettextf("DLL %s not found", sQuote(chname1)), domain = NA)
else
stop(gettextf("shared object '%s' not found", sQuote(chname1)),
stop(gettextf("shared object %s not found", sQuote(chname1)),
domain = NA)
if(verbose)
message(gettextf("now dyn.unload(\"%s\") ...", file), domain = NA)
Expand Down
2 changes: 1 addition & 1 deletion src/library/base/R/load.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ save <- function(..., list = character(),
}
else if (inherits(file, "connection"))
con <- file
else stop("bad file argument")
else stop("bad 'file' argument")
if(isOpen(con) && !ascii && summary(con)$text != "binary")
stop("can only save to a binary connection")
.Internal(saveToConn(list, con, ascii, version, envir, eval.promises))
Expand Down
4 changes: 2 additions & 2 deletions src/library/base/R/locales.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
Sys.getlocale <- function(category = "LC_ALL")
{
category <- match(category, .LC.categories)
if(is.na(category)) stop("invalid 'category' argument")
if(is.na(category)) stop(gettextf("invalid '%s' argument", "category"), domain=NA)
.Internal(Sys.getlocale(category))
}

Sys.setlocale <- function(category = "LC_ALL", locale = "")
{
category <- match(category, .LC.categories)
if(is.na(category)) stop("invalid 'category' argument")
if(is.na(category)) stop(gettextf("invalid '%s' argument", "category"), domain=NA)
.Internal(Sys.setlocale(category, locale))
}

Expand Down
Loading