0

我正在尝试使用 R tabulizer 包从 pdf 中收集数据。但是,当我尝试将数据转换为数据框并将其导出为 CSV 时出现错误。我的代码如下。有人可以帮我解决这个问题吗?

# Library packages

if (!require(Rtools)) {         
  install.packages("Rtools", dep=TRUE)      
  library(Rtools)
}

if (!require(rJava)) {         
  install.packages("rJava", dep=TRUE)      
  library(rJava)
}

if (!require(tabulizer)) {         
  install.packages("tabulizer", dep=TRUE)      
  library(tabulizer)
}

rm(list = ls())
setwd("MyPath")

site <- "https://cptnacional.org.br/component/jdownloads/send/36-conflitos-por-terra-ocorrencias/14151-conflitos-por-terra-ocorrencias-2018?Itemid=0"


# default call with no parameters changed
matrix_results <- extract_tables(site)

# get back the tables as data frames, keeping their headers
df_results <- extract_tables(site, output = "data.frame")

first_df <- df_results[[1]]
View(first_df)

text <- extract_text(site)

# print text
cat(text)


write.csv(text, file = "test.csv")
4

0 回答 0