I am using the R programming language. I have a "data frame" called "a" that has 2 rows and 1 column (the column is called "file.list"):
>head(a)
file.list
1 C:/Users/Documents/files_i_want/1_a.pdf
2 C:/Users/Documents/files_i_want/a_1.pdf
I am trying to write a "for loop" that performs an operation using each "element" from this data frame:
library(tesseract)
library(pdftools)
for (i in 1:2)
{
file_i = tesseract::ocr(a[i, "file.list"])
}
The above code successfully runs:
Converting page 1 to 1_a_1.png... done!
Converting page 1 to a_1_1.png... done!
Problem: The above loop is only creating a single file instead of two files. Does anyone know why this is happening? Can someone please show me how to fix this problem?
Thanks