The system cannot find the file specified


#1

Hi All--

I have a simple code to extant tables from PDF files using R-Tabulizer package. My code is below. I had the same problem with my home computer where i deleted the folder and recreated it and the problem was solved.

I tried the same code on my office computers but i kept getting the same error again. i deleted and recreated the folder but did not work. All my computers run the same software.

here is my code and the error message.
Any help is greatly appreciated.

EK.
++++++++++ code +++++++
install.packages("tabulizer")
installed.packages("stringr")
library(stringi)
library(tabulizer)
path = "C:/Users/eesawi/Downloads/MyFiles"
file.names <- dir(path, pattern =".PDF")

for(i in 1:length(file.names)){
print(file.names[i])
A[[i]] <- extract_tables(file.names[i])
}

[1] "August 23.PDF"
Error in normalizePath(path.expand(path), winslash, mustWork) :
path[1]="August 23.PDF": The system cannot find the file specified


#2

Perhaps the issue is that dir returns local paths instead of full path names?

Try adding full.names = TRUE like so:

file_names <- dir(path, pattern = ".PDF", full.names = TRUE)

#3

Thank you, It worked.
EK


#4

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.

Thanks