库(qdap)中的错误:没有名为“qdap”的包

Error in library(qdap) : there is no package called ‘qdap’

我已经安装了 qdap:

install.packages("qdap")

下载所有内容需要一段时间,但控制台已填满所有下载内容,最后我收到如下消息:

Warning in install.packages :
  installation of package ‘qdap’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpeTzuKz/downloaded_packages’
> library(qdap)
Error in library(qdap) : there is no package called ‘qdap’
> 

所以 post 让我尝试添加 dependencies = TRUE 但问题仍然存在。

这是session信息

sessionInfo():
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0   

我昨天发现的另一个 post(现在无法通过 Google 搜索再次找到它)建议我删除我的库目录中现有的 qdap 文件,关闭我的 session,重新启动并全新安装。没有完全称为 qdap 的包,但我删除了一些名称中带有 qdap 的包。我的问题依然存在,我无法安装 qdap。

我不确定还需要提供什么其他信息?任何帮助表示赞赏。

以下是尝试安装 qdap 时生成的错误:

./configure: line 3736: /usr/lib/jvm/default-java/jre/bin/java: No such file or directory no configure: error: Java interpreter '/usr/lib/jvm/default-java/jre/bin/java' does not work ERROR: configuration failed for package ‘rJava’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/rJava’ Warning in install.packages : installation of package ‘rJava’ had non-zero exit status ERROR: dependency ‘rJava’ is not available for package ‘openNLPdata’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/openNLPdata’ Warning in install.packages : installation of package ‘openNLPdata’ had non-zero exit status ERROR: dependency ‘rJava’ is not available for package ‘xlsxjars’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/xlsxjars’ Warning in install.packages : installation of package ‘xlsxjars’ had non-zero exit status ERROR: dependency ‘rJava’ is not available for package ‘venneuler’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/venneuler’ Warning in install.packages : installation of package ‘venneuler’ had non-zero exit status ERROR: dependencies ‘openNLPdata’, ‘rJava’ are not available for package ‘openNLP’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/openNLP’ Warning in install.packages : installation of package ‘openNLP’ had non-zero exit status ERROR: dependencies ‘rJava’, ‘xlsxjars’ are not available for package ‘xlsx’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/xlsx’ Warning in install.packages : installation of package ‘xlsx’ had non-zero exit status ERROR: dependencies ‘openNLP’, ‘venneuler’, ‘xlsx’ are not available for package ‘qdap’ * removing ‘/home/myname/R/x86_64-pc-linux-gnu-library/3.4/qdap’ Warning in install.packages : installation of package ‘qdap’ had non-zero exit status

由于这看起来像是一个 rJava 问题,我发现 this post 并在终端中尝试了投票最高的答案:

apt-get install r-cran-rjava

结果:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

我希望无需成为 root 用户即可解决此问题?我对 linux 不太熟悉。我可以安装其他 p 包。

当您没有 root 访问权限时,这个问题有一个解决方案。

  1. 下载Java(确保安装JDK)并将其安装在您的$HOME

    你可以这样做,因为 Oracle 的 Java 只是一个 tar.gz 包

  2. 确保设置JAVA_HOME

    export JAVA_HOME=$HOME/opt/my_jdk_installation
    
  3. 一旦你有 Java 你必须重新配置 R

    只需告诉 R 您的 Java 在哪里

    R CMD javareconf \
    JAVA_HOME=${JAVA_HOME} \
    JAVA=${JAVA_HOME}/bin/java \
    JAVAC=${JAVA_HOME}/bin/javac \
    JAVAH=${JAVA_HOME}/bin/javah \
    JAR=${JAVA_HOME}/bin/jar \
    JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/server \
    JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
    

从现在开始,R 应该使用您个人安装的 Java。这样,您就不会依赖系统管理员。