[R] Problems when I try to download.file pdfs

Duncan Temple Lang duncan at wald.ucdavis.edu
Fri Nov 14 19:04:52 CET 2008



Henrik Bengtsson wrote:
> See ?download.file and argument 'mode'.  You want to use mode="wb".
> 
> To R-core: I've asked it before, isn't the most common use case to
> download files in 'binary' mode?  I cannot even remember when I last
> wanted to transfer a file in 'text' mode.  I vote for making mode="wb"
> the default.


Ideally, when doing this "ourselves" (rather than with external 
applications), we would look at the header of the HTTP response and 
determine the content based on the Content-Type field.
This is more reliable than having users specify it. So mode = NA
would be a better default.

(Coincidentally, I implemented this in the RCurl package just
yesterday in the getURLContent() function.)

> 
> /Henrik
> 
> On Fri, Nov 14, 2008 at 7:21 AM, Fernando Bizuet <fbizuet at gmail.com> wrote:
>> Hello,
>> I have been trying to download a pdf file but I only receive
>> a blank sheets.
>>
>> I used the option internet2 in windows:
>>
>> Rgui.exe --internet2
>>
>> but I recieved the same result.
>>
>> I use the next command:
>>
>> ulr2 <- "http://cran.r-project.org/doc/manuals/R-intro.pdf"
>>
>> download.file(url = ulr2, destfile = "D:\\users2\\r-intro.pdf",cacheOK =
>> FALSE)
>> Any ideas how I can resolve this problem?
>>
>> Thanks in advance,
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list