3

使用github中描述的说明并使用 Chocolatey 相应地安装 Java——加上在 R 中安装rJava和设置路径Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jdk1.8.0_131")——我在 R 中完成了以下操作:

library(ghit)
library(git2r)
ghit::install_github(c("leeper/tabulizerjars", "leeper/tabulizer"), INSTALL_opts = "--no-multiarch", dependencies = c("Depends", "Imports"))

这是此答案中提供的解决方案。我收到以下错误:

Error in git2r::init(d) : 
  Error in 'git2r_repository_init': Unable to init repository

VERBOSE = TRUE在I 中设置选项install_github会得到以下附加输出:

Parsing reponame for 'leeper/tabulizerjars'...
Creating local git repository for tabulizerjars in C:\Users\JOOCAR~1\AppData\Local\Temp\RtmpgnitDP\tabulizerjars1643e0126f5...
Error in git2r::init(d) : 
  Error in 'git2r_repository_init': Unable to init repository

我读了这个答案,似乎它与我的用户名有关,该用户名是间隔的并且有口音。但是我该如何配置呢?


编辑:2017 年 6 月 4 日凌晨 1 点 57 分

在用户@jaySf 回答之后,我运行了他回答的部分代码(因为我已经安装了rJavaand devtools):

library(rJava) # load and attach 'rJava' now
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")

并得到以下错误:

> library(rJava) # load and attach 'rJava' now
> devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
Downloading GitHub repo ropensci/tabulizer@master
from URL https://api.github.com/repos/ropensci/tabulizer/zipball/master
Installing tabulizer
Downloading GitHub repo ropensci/tabulizerjars@master
from URL https://api.github.com/repos/ropensci/tabulizerjars/zipball/master
Installing tabulizerjars
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo  \
  Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c50925145/ropensci-tabulizerjars-c6cc40e" --library="C:/R-3.4.0/library" --install-tests 

* installing *source* package 'tabulizerjars' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'tabulizerjars':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/R-3.4.0/library/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/R-3.4.0/library/tabulizerjars'
Installation failed: Command failed (1)
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo  \
  Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c4a2835ec/ropensci-tabulizer-a38d957" --library="C:/R-3.4.0/library" --install-tests --no-multiarch 

ERROR: dependency 'tabulizerjars' is not available for package 'tabulizer'
* removing 'C:/R-3.4.0/library/tabulizer'
Installation failed: Command failed (1)

我相信我在文件目录路径中的用户名可能有问题,但我不确定。我尝试使用install_github--`install_github ggplot2("wch/ggplot2") -- 效果很好。如果我的猜测是正确的,我该如何编辑文件路径?


问题解决了

我正在运行安装了 32 位和 64 位文件的 R。我无法清楚地说明这样做有什么问题,因为我之前运行Sys.getenv("R_ARCH")它时返回了x64,但是当我卸载 32 位文件时,它与@jaySf 代码一起运行得非常好。

4

3 回答 3

3

按照给定顺序执行以下步骤应该可以工作:

install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")

我在 win64 上使用 R 3.4.0,并在以前的答案中描述了该过程。

于 2017-06-03T19:19:27.303 回答
0
install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
#run below package first..
devtools::install_github("ropensci/tabulizerjars", args="--no-multiarch") 
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
于 2019-12-03T13:54:47.543 回答
0

你可以试试:

devtools::install_github("ropensci/tabulizerjars", INSTALL_opts = c("--no-multiarch")) 

devtools::install_github("ropensci/tabulizer", INSTALL_opts = c("--no-multiarch"))
于 2021-12-13T07:18:13.223 回答