I'm trying to convert a pdf into a dataframe, however because the column titles are being repeated on each page (and there's a note on the final page), I'm finding it difficult to think of an appropriate way of putting it into a dataframe while simultaneously dealing with any dynamic issues.
I've read it into R as an object in the following method:
library(pdftools)
library(dplyr)
library(tidyverse)
temps <- tempfile(fileext = ".pdf")
download.file("https://www.dmo.gov.uk/dmo_static_reports/Gilt%20Operations.pdf", destfile = temps, mode="wb")
And I'm thinking I would do something like:
ops <- pdf_text(temps) %>%
readr::read_lines()
Then I was thinking about dropping the unnecessary lines explicitly, then converting it into a dataframe. However given the issues mentioned above, I don't think that'll work in the long term.
Does anyone have any advice on the best solution for this?