sqldf 未安装在 Ubuntu 14.04 上

sqldf doesn't install on Ubuntu 14.04

我正在尝试在 Ubuntu 14.04 机器上安装 sqldf 包,但出现以下错误:

Warning in install.packages :
  package ‘sqldf’ is not available (for R version 3.0.2)

我尝试安装库 libpq-dev as suggested from other 帖子,但我仍然收到消息。

更新

我正在尝试更新 R,但收到以下消息:

The following packages have unmet dependencies:
 r-base : Depends: r-base-core (>= 3.1.2-1precise0) but it is not going to be installed
          Depends: r-recommended (= 3.1.2-1precise0) but it is not going to be installed
          Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我尝试了解决方案 in this topic,但没有一个奏效

看看 package page:

Depends:    R (≥ 3.1.0), gsubfn (≥ 0.6), proto, RSQLite (≥ 1.0.0)

正如错误消息明确指出的那样,您使用的是低于所需 3.1.0 的旧版 R 3.0.2。

修复很简单:阅读 Ubuntu-specific README,进行调整以通过 apt-get 从 CRAN 安装(当前 !!)R 二进制文件作为 .deb 包——您将拥有 R 3.1 .2 很快。

这也将允许您安装当前的 sqldf。

我关注了 these instructions,一切正常!

sudo add-apt-repository ppa:marutter/rrutter
sudo apt-get update
sudo apt-get install r-base r-base-dev

你可以通过这个尝试解决这个问题:

# Install function for packages    
packages<-function(x) {    
  x<-as.character(match.call()[[2]])
  if (!require(x,character.only=TRUE)) {
    install.packages(pkgs=x,repos="http://cran.r-project.org")
    require(x,character.only=TRUE)
  }
}

packages(ggplot2)
packages(reshape2)
packages(plyr)
# etc ...other packages

这就是全部享受..!!