Displaying 2 results from an estimated 2 matches for "convertpdf2txt".
2023 Jul 05
1
textual analysis - transforming several pdf to txt - naming the files
...but the names of txt files that I obtain are: pdftext1, pdftext2, pdftext3...
What do I need to change?
Thank you very much,
Cec?lia Carmo
Universidade de Aveiro - Portugal
dirpath <- ("/Users/ceciliacarmo/documents/RTextualAnalysis/data/pdfs")
library(pdftools)
library(dplyr)
convertpdf2txt <- function(dirpath){
files <- list.files(dirpath, full.names = T)
x <- sapply(files, function(x){
x <- pdftools::pdf_text(x) %>%
paste0(collapse = " ") %>%
stringr::str_squish()
return(x)
})
}
# apply function
txts <- convertpdf2txt(here::he...
2023 Jul 05
1
textual analysis - transforming several pdf to txt - naming the files
convertpdf2txt <- function(dirpath){
files <- list.files(dirpath, pattern = "Consoli.*\\.pdf$", full.names
= TRUE)
files <- chartr("\\", "/", files)
x <- lapply(files, function(x){
pdftools::pdf_text(x) %>%
paste0(collapse = " ") %>%...