Installing ggplot “subscript out of bounds” error

2019-06-28 02:35发布

$ R
R version 2.12.2 (2011-02-25)
Platform: i486-pc-linux-gnu (32-bit)

> install.packages("ggplot2", dep="T")
Error in apply(available[p1, dependencies, drop = FALSE], 1L, function(x)  paste(x[!is.na(x)],  : 
  subscript out of bounds

What can I do to install ggplot2?

标签: r ggplot2
1条回答
乱世女痞
2楼-- · 2019-06-28 02:54

Do read the help for functions! From ?install.packages we have:

dependencies: logical indicating to also install uninstalled packages
          on which these packages depend/suggest/import (and so on
          recursively).  Not used if ‘repos = NULL’.  Can also be a
          character vector, a subset of ‘c("Depends", "Imports",
          "LinkingTo", "Suggests", "Enhances")’.

So this clearly states that you need to supply a logical value, a TRUE or a FALSE. "T" is not a logical TRUE and neither is T really. Always spell out TRUE and FALSE otherwise you could get into lots of trouble. It isn't worth the hassle to save on a few keystrokes.

As I showed in the answer to the previous Q:

R> install.packages("ggplot2", dependencies = TRUE)

works. So why did you alter what I showed you did work?

查看更多
登录 后发表回答