wget - download an article using DOI in R -


i have doi article, wondering if there r functions can download pdf file based on doi without user having download pdf manually ?

you can use httr see doi points constructing url doi.org , getting headers:

library(httr) headers = head("http://doi.org/10.7150/ijms.11309") headers$url # [1] "http://www.medsci.org/v12p0264.htm" 

in case, pdf seems @ same location page, .pdf extension. not true journals.

so journal, pdf at:

sub(".htm$",".pdf",headers$url) # [1] "http://www.medsci.org/v12p0264.pdf" 

so can do:

download.file(sub(".htm$",".pdf",headers$url),"paper.pdf") 

to pdf.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -