Skip to content
Prev 36373 / 63421 Next

inject html code into Rd file

Sounds like a good idea. The RCurl package can also do the base64
encoding (depends on libcurl), e.g.

library(RCurl)
img <- function() {
    tf <- tempfile()
    tf.out <- tempfile()
    png(tf, width = 500, height = 500)
    plot(1:100, rnorm(100), pch = 21, bg = "red", cex = 2)
    dev.off()
    img <- readBin(tf, "raw", file.info(tf)[1, "size"])
    b64 <- base64Encode(img, "character")
    sprintf("<img src=\"data:image/png;base64,%s\" />", b64)
}
writeLines(img(), "test.html")

I saw your blog post today about your base64 package. My concern is IE
(<=7) does not support data uri...

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



On Sat, Apr 3, 2010 at 3:11 AM, Romain Francois
<romain at r-enthusiasts.com> wrote: