R/png64.R

Defines functions png64

Documented in png64

#' png64 Function
#' 
#' This function creates a plot object that can be used in a moodle quiz
#' @param plt some graph object
#' @return a character vector 
#' @export

png64 = function(plt) {
  pngfile = tempfile()
  grDevices::png(pngfile, width = 400, height = 400)
  print(plt)
  grDevices::dev.off()
  pltout = base64::img(pngfile, Rd = TRUE, alt = "a")
  m = nchar(pltout)
  pltout = substring(pltout, 6, m-1)
  pltout
}

Try the moodlequizR package in your browser

Any scripts or data that you put into this service are public.

moodlequizR documentation built on May 29, 2024, 9:12 a.m.