I am trying to collect data from a pdf using the R tabulizer package. However then I got an error when I try to convert the data to a dataframe and export it to CSV. My code is below. Could someone help me with this?
# 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")