error "The system cannot find the file specified..."

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

error "The system cannot find the file specified..."

Ek Esawi
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])}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: error "The system cannot find the file specified..."

Bert Gunter-2
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 <[hidden email]> 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])}
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: error "The system cannot find the file specified..."

Rui Barradas
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])}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: error "The system cannot find the file specified..."

Ek Esawi
Thank you Bert and Rui. Everything mentioned on your posts was OK with
the exception of a typo in my original post where [a] was instead
[[a]]. I stumbled one something that stated if i delete the
sub-directory and create it it again might work. In my case once that
was done, it worked.

Thanks again,
EK
On Sun, Sep 23, 2018 at 5:30 AM Rui Barradas <[hidden email]> wrote:

>
> 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])}

______________________________________________
[hidden email] 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.