Hi All, I am using the R Tabulizer package to extract tables from a set of pdf files. Tabulizer creates a list of data frames; each corresponds to a table in a file. My aim is to create a list of lists, one for each file.i have 8 files The code below kept giving me the error "Error in normalizePath(path.expand(path), winslash, mustWork) : path[1]="April 24.PDF": The system cannot find the file specified". But when i used table_extract (file) for individual files, it works perfectly. Any help is greatly appreciated. EK path = "C:/Users/name/Documents/TextMining/" file.names <- dir(path, pattern =".PDF") A <- vector("list", length(file.names)) for(i in 1:length(file.names)){ A[i] <- extract_tables(file.names[i])}
Bert Gunter
2018-Sep-23 00:45 UTC
[R] error "The system cannot find the file specified..."
You probably want pattern = "\\.PDF" , as "." has a special meaning for regex's. However, that really shouldn't make any difference. Obvious questions: 1. dir() returns a vector of file names. Are they pdf's "PDF" or "pdf" (case matters!) ? 2. extract.tables() almost certainly wants the full path names to the files, not just the file names, if your working directory isn't set to the directory containing the files. So what does getwd() give? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sat, Sep 22, 2018 at 4:22 PM Ek Esawi <esawiek at gmail.com> wrote:> Hi All, > > I am using the R Tabulizer package to extract tables from a set of pdf > files. Tabulizer creates a list of data frames; each corresponds to a > table in a file. My aim is to create a list of lists, one for each > file.i have 8 files > The code below kept giving me the error "Error in > normalizePath(path.expand(path), winslash, mustWork) : path[1]="April > 24.PDF": The system cannot find the file specified". But when i used > table_extract (file) for individual files, it works perfectly. > > Any help is greatly appreciated. > > > EK > > > path = "C:/Users/name/Documents/TextMining/" > file.names <- dir(path, pattern =".PDF") > A <- vector("list", length(file.names)) > for(i in 1:length(file.names)){ > A[i] <- extract_tables(file.names[i])} > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Rui Barradas
2018-Sep-23 09:29 UTC
[R] error "The system cannot find the file specified..."
Hello, I would add that it's probably better to assign for(i in seq_along(file.names)){ A[[i]] <- extract_tables(file.names[i]) } (It's a list so double [[, not just [). Hope this helps, Rui Barradas ?s 01:45 de 23/09/2018, Bert Gunter escreveu:> for(i in 1:length(file.names)){ > A[i] <- extract_tables(file.names[i])}