安装`qdap`-无法安装

时间:2019-09-13 22:59:06

标签: r

我正在尝试安装qdap,但是我一直遇到错误。

我尝试了以下方法:

方法1:

> install.packages("qdap")
Installing package into ‘C:/Users/USER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/qdap_2.3.2.zip'
Content type 'application/zip' length 3636513 bytes (3.5 MB)
downloaded 3.5 MB

package ‘qdap’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\USER\AppData\Local\Temp\Rtmp4eaFAF\downloaded_packages

所以我认为它已成功安装,然后运行以下命令:

> library(qdap)
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry

方法2:

从GitHub下载软件包并手动安装。

install.packages("C:/Users/MYUSER/Downloads/qdap-master.zip",repos=NULL)

使用devtools:

   > devtools::install_github("trinker/qdap")
Downloading GitHub repo trinker/qdap@master
These packages have more recent versions available.
Which would you like to update?

1: All                          
2: CRAN packages only           
3: None                         
4: tidyr (0.8.3 -> 1.0.0) [CRAN]
5: sys   (3.2   -> 3.3  ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
1
tidyr (0.8.3 -> 1.0.0) [CRAN]
sys   (3.2   -> 3.3  ) [CRAN]
Skipping 1 packages not available: Imports: chron
Installing 3 packages: Imports: chron, tidyr, sys
Installing packages into ‘C:/Users/USER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Error: Failed to install 'qdap' from GitHub:
  (converted from warning) package ‘Imports: chron’ is not available (for R version 3.6.1)

方法:3

    > install.packages("pacman")
Installing package into ‘C:/Users/USER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/pacman_0.5.1.zip'
Content type 'application/zip' length 389806 bytes (380 KB)
downloaded 380 KB

package ‘pacman’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\USER\AppData\Local\Temp\Rtmp4eaFAF\downloaded_packages
> pacman::p_load_gh(
+   "trinker/qdapDictionaries",
+   "trinker/qdapRegex",
+   "trinker/qdapTools",
+   "trinker/qdap"
+ )
Warning message:
In pacman::p_load_gh("trinker/qdapDictionaries", "trinker/qdapRegex",  : 
Failed to install/load:
trinker/qdap

1 个答案:

答案 0 :(得分:2)

如PavoDive所述,安装jre。请访问Oracle网站以获取最新版本。安装完成后,运行以下代码段

Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\<jre version>') # if you are using 64-bit R
Sys.setenv(JAVA_HOME='C:\\Program Files (x86)\\Java\\<jre version>') # if you are using 32-bit R

现在,您尝试加载的软件包应该可以正常工作。