【发布时间】:2018-09-05 13:49:35
【问题描述】:
我需要从 pdf 中提取表格。这是链接
https://ainfo.cnptia.embrapa.br/digital/bitstream/item/155505/1/doc-202-1.pdf
我想从第 15 页到第 21 页中提取表格。所有这些表格都具有相同的结构(18 列)和标题。这是单个表的快照。
在每个表中,我只对第 6 - 8 列和第 17 列感兴趣:Ciclo、Graus Dias/dias、Epcaja de PlantionandRegiao de Adaptacao`
这就是我所做的:
library(dplyr)
library(tabulizer)
out <- extract_tables("mydocument.pdf"), pages = c(15:21))
# this gives me a list of 7 tables.
temp <- data.frame(out[[1]]) # taking the first table as an example
temp %>% dplyr::select(X3, X4, X5, X12) # these are the columns corresponding to `Ciclo`, `Graus Dias/dias`, Epcaja de Plantion` and `Regiao de adaptacao`
# this is a snapshot of first table
但是,当我提取第 7 个表时:
temp <- data.frame(out[[7]])
# Column 1: 4 are merged into a single column.
综上所述,extract_tables 函数在某些表中没有做一致的列位置和合并列。我该如何解决它,以便我拥有
在一个 csv 文件中包含 Ciclo,Graus Dias/dias, Epcaja de Plantion 和 Regiao de adaptacao 列的组合表。
【问题讨论】: