download_image | R Documentation |
When including images in non-HTML output formats such as LaTeX/PDF, URLs will
not work as image paths. In this case, we have to download the images. This
function is a wrapper of xfun::download_file()
and
include_graphics()
.
download_image(
url,
path = xfun::url_filename(url),
use_file = !pandoc_to("html"),
...
)
url |
The URL of an image. |
path |
The download path (inferred from the URL by default). If the file exists, it will not be downloaded (downloading can take time and requires Internet connection). If you are sure the file needs to be downloaded again, delete it beforehand. |
use_file |
Whether to use the URL or the download path to include the image. By default, the URL is used for HTML output formats, and the file path is used for other output formats. |
... |
Other arguments to be passed to |
knitr::download_image("https://www.r-project.org/Rlogo.png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.