rr-markdownknitrcran

R package on CRAN: reference online images in vignette such that "Internet resources should fail gracefully"


CRAN has the following policy: Internet resources should fail gracefully.

I have an accepted package with vignettes that use Rmarkdown. One of the vignettes involve a lot of images, so rather than embed the raw images in the vignette, I reference the images on Flickr (to keep the package size small enough to be hosted on CRAN). Every half year or so, I'll get a message from the CRAN maintainers that the package is not failing gracefully on one of their servers:

     Could not fetch
https://live.staticflickr.com/65535/52281215570_5f9cc90a12_o.png
     HttpExceptionRequest Request {
      host = "live.staticflickr.com"
      port = 443
      secure = True
      requestHeaders = []
      path = "/65535/52281215570_5f9cc90a12_o.png"
      queryString = ""
      method = "GET"
      proxy = Nothing
      rawBody = False
      redirectCount = 10
      responseTimeout = ResponseTimeoutDefault
      requestVersion = HTTP/1.1
     }
      (ConnectionFailure Network.Socket.getAddrInfo (called with
preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG],
addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0,
addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be
undefined>}, host name: Just "live.staticflickr.com", service name: Just
"443"): does not exist (Name or service not known))
     Error: processing vignette
'Ex-04-Webscraping-Online-Data-Files.Rmd' failed with diagnostics:
     pandoc document conversion failed with error 61

What is the proper way to make this fail gracefully? Again, I am pointing to the images online.

Thanks.


Solution

  • As @rui-barradas has suggested, I posted to the r-package-devel listserv to solicit help. Ivan Krylov suggested using the option self-contained: false option in the Rmd file yaml header to not embed the images. Unfortunately, this also applies to the CSS style sheets. This at least prevents the pandoc error when creating the html file when internet resources aren't available.