我正在尝试安装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方法二:
从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发布于 2019-09-14 12:54:27
正如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现在,您尝试加载的包应该可以正常工作。
https://stackoverflow.com/questions/57931183
复制相似问题