Troy Walters uses the Tabulizer package to extract tables from a PDF and turn them into an R matrices or data frames:
Next we will use the
tabulizer. First, I specify the url of the pdf file from which I want to extract a table. This pdf link includes the most recent data, covering the period from July 1, 2016 to November 25, 2016. I am using the default parameters for
extract_tables. These are guess and method. I’ll leave guess set to TRUE, which tells tabulizer that we want it to figure out the locations of the tables on its own. We could set this to
FALSEif we want to have more granular control, but for this application we don’t need to. We leave the method argument set to “matrix”, which will return a list of matrices (one for each pdf page). This could also be set to return data frames instead.
This is nice. I have to imagine it only works for text-based PDFs and not ones which are generated from a series of images.