在R中安装tabulizer软件包

3

我正在使用R版本3.4.0。我的电脑是64位的Windows 10。

我想在R中从PDF文档中提取数据框。

我尝试使用github安装tabulizer包,但是我遇到了以下错误。

> ghit::install_github(c("ropenscilabs/tabulizerjars", "ropenscilabs/tabulizer"), INSTALL_opts = "--no-multiarch")
also installing the dependencies ‘httpuv’, ‘sourcetools’

also installing the dependency ‘rJava’

ropenscilabs/tabulizerjars     ropenscilabs/tabulizer 
                        NA                         NA 
There were 14 warnings (use warnings() to see them)
> library("tabulizer")
Error in library("tabulizer") : there is no package called ‘tabulizer’

以下是警告内容:
> warnings()
Warning messages:
1: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/downloaded_packages/httpuv_1.3.3.tar.gz' had status 1
2: In utils::install.packages(suggests, type = type, repos = repos,  ... :
  installation of package ‘httpuv’ had non-zero exit status
3: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/downloaded_packages/sourcetools_0.1.6.tar.gz' had status 1
4: In utils::install.packages(suggests, type = type, repos = repos,  ... :
  installation of package ‘sourcetools’ had non-zero exit status
5: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/downloaded_packages/shiny_1.0.3.tar.gz' had status 1
6: In utils::install.packages(suggests, type = type, repos = repos,  ... :
  installation of package ‘shiny’ had non-zero exit status
7: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/downloaded_packages/miniUI_0.1.1.tar.gz' had status 1
8: In utils::install.packages(suggests, type = type, repos = repos,  ... :
  installation of package ‘miniUI’ had non-zero exit status
9: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/downloaded_packages/rJava_0.9-8.tar.gz' had status 1
10: In utils::install.packages(to_install, type = type, repos = repos,  ... :
  installation of package ‘rJava’ had non-zero exit status
11: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/ghitdrat/src/contrib/tabulizerjars_0.9.2.tar.gz' had status 1
12: In utils::install.packages(to_install, type = type, repos = repos,  ... :
  installation of package ‘tabulizerjars’ had non-zero exit status
13: running command '"C:/PROGRA~1/R/R-34~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\akshay\Documents\R\win-library\3.4" C:\Users\akshay\AppData\Local\Temp\Rtmp6RtCtU/ghitdrat/src/contrib/tabulizer_0.1.24.tar.gz' had status 1
14: In utils::install.packages(to_install, type = type, repos = repos,  ... :
  installation of package ‘tabulizer’ had non-zero exit status

看起来那里没有足够的信息来知道问题是什么。在尝试安装后,你应该像错误消息建议的那样调用warnings(),看看它是否提供了额外的信息。 - undefined
我现在在我的问题中包含了警告信息。 - undefined
好的,看起来基本上没有安装正确所需的软件包,所以肯定出了问题。你是否已经安装了Rtools?你应该尝试逐个安装一些东西,比如install.packages("httpuv"),以便分离出问题。 - undefined
问题已经解决。我逐个安装了警告部分中的所有软件包,然后安装了tabulizer。现在它运行良好。谢谢Marius! - undefined
1个回答

5
大多数问题都是由于您的R会话中64位设置引起的。如果要使用“tabulizer”,请将R会话设置为32位。如果您正在运行GUI,则更改其中的设置是最简单的方法。如果您使用的是R-studio等软件,请参见https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R

之后运行:

install.packages("remotes") #获取包(如果没有)

library(remotes)

remotes::install_github(c("ropensci/tabulizerjars", "ropensci/tabulizer"), INSTALL_opts = "--no-multiarch", dependencies = c("Depends", "Imports"))

如果出现错误,请逐个安装软件包。 如果您没有软件包,请使用install.packages("plyr")获取软件包。
library(plyr)

packs <- c('stringi', 'httpuv', 'digest', 'htmltools', 'sourcetools', 'evaluate', 'markdown', 
           'stringr', 'yaml', 'rJava', 'testthat')

laply(packs, function(x){
  install.packages(x)  
  readline(prompt="Press [enter] to continue")
}
  )

如果出现错误,请在Stack上发布。 如果没有任何包出现错误(因此按[Enter]继续),则可以使用以下命令安装Tabulizer:

remotes::install_github(c("ropensci/tabulizerjars", "ropensci/tabulizer"), INSTALL_opts = "--no-multiarch", dependencies = c("Depends", "Imports"))

这返回:leeper/tabulizerjars leeper/tabulizer NA NA 警告信息: 1: 在 utils::install.packages(to_install, type = type, repos = repos, : 安装包‘tabulizerjars’时出现非零退出状态 2: 在 utils::install.packages(to_install, type = type, repos = repos, : 安装包‘tabulizer’时出现非零退出状态 - undefined
试试这个 ghit::install_github(c("ropensci/tabulizerjars", "ropensci/tabulizer"))。在 GitHub 上(https://github.com/ropensci/tabulizer#installation)还有一个安装部分,特别是(https://github.com/ropensci/tabulizer#installing-java-on-windows-with-chocolatey)部分,因为大多数安装问题都是由于 Java 引起的。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接