This function takes an image file and uses the markdown package to
encode it as a base64 string, which can be used in the img
tag in
HTML.
image_uri(f)
Path to the image file.
The data URI as a character string.
# NOT RUN {
uri = image_uri(file.path(R.home("doc"), "html", "logo.jpg"))
if (interactive()) {
cat(sprintf("<img src=\"%s\" />", uri), file = "logo.html")
browseURL("logo.html") # you can check its HTML source
}
# }
Run the code above in your browser using DataLab