执行时:
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-2.1")
它适用于R但不适用于RStudio。为什么呢?
在RStudio我得到:
> install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-2.1")
Error in install.packages : missing value where TRUE/FALSE needed
追溯:
> traceback()
3: installed.packages()
2: as.data.frame(installed.packages(), stringsAsFactors = F)
1: (function ()
{
uniqueLibPaths <- .rs.uniqueLibraryPaths()
x <- suppressWarnings(library(lib.loc = uniqueLibPaths))
x <- x$results[x$results[, 1] != "base", ]
pkgs.name <- x[, 1]
pkgs.library <- x[, 2]
pkgs.desc <- x[, 3]
pkgs.url <- file.path("help/library", pkgs.name, "html",
"00Index.html")
loaded.pkgs <- .rs.pathPackage()
pkgs.loaded <- !is.na(match(normalizePath(paste(pkgs.library,
pkgs.name, sep = "/")), loaded.pkgs))
instPkgs <- as.data.frame(installed.packages(), stringsAsFactors = F)
pkgs.version <- character(length = length(pkgs.name))
for (i in 1:length(pkgs.name)) {
pkgs.version[[i]] <- .rs.packageVersion(pkgs.name[[i]],
pkgs.library[[i]], instPkgs)
}
pkgs.library <- .rs.createAliasedPath(pkgs.library)
packages = data.frame(name = pkgs.name, library = pkgs.library,
version = pkgs.version, desc = pkgs.desc, url = pkgs.url,
loaded = pkgs.loaded, check.rows = TRUE, stringsAsFactors = FALSE)
packages[order(packages$name), ]
})()
我使用Windows 10 Enterprise和RStudio 1.0.143以及:
> R.version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
nickname You Stupid Darkness