Problems with Downloading pdf file using R

前端 未结 2 1809
后悔当初
后悔当初 2021-01-04 01:00

I would like to download a pdf file from the internet and save it in the local HD. After download, the pdf output file has lots of empty pages. What can I do to fix it?

相关标签:
2条回答
  • 2021-01-04 01:14

    you can download pdfs and export tables as data.frame using tabulizer package

    https://ropensci.org/tutorials/tabulizer_tutorial.html

    install.packages("devtools")
    # on 64-bit Windows
    ghit::install_github(c("ropenscilabs/tabulizerjars", "ropenscilabs/tabulizer"), INSTALL_opts = "--no-multiarch")
    # elsewhere
    ghit::install_github(c("ropenscilabs/tabulizerjars", "ropenscilabs/tabulizer"))
    
    library(tabulizer)
    
    f2 <- "https://github.com/leeper/tabulizer/raw/master/inst/examples/data.pdf"
    extract_tables(f2, pages = 1, method = "data.frame")
    
    0 讨论(0)
  • 2021-01-04 01:18

    Try with wb-mode like this:

    download.file(url, 'introductionToR.pdf', mode="wb").

    For me it works that way.

    0 讨论(0)
提交回复
热议问题