This is an attempt to set up a chunk hook for adding plots to the recordr data store "invisibly."

Currently, this hook function works for the last ggplot object plotted.

library(recordr)
library(histry)
kt = knitr_tracker()
vtdb = jsonVTDB(tempfile(), img_dir = tempdir())
defaultVTDB(vtdb)
library(knitr)
knit_hooks$set(plot = recordr:::recplothook)
opts_chunk$set(
    out.width='\\textwidth',
    fig.height=8, fig.width=12.8, dpi=300,
    # tidy.opts=list(width.cutoff=200),
    # global.device = TRUE,
    fig.align='center', message=FALSE, cache=2
    )
library(ggplot2)
qplot(speed, dist, data = cars)
p = qplot(speed, dist, data = cars)
p = p + geom_smooth()
p + geom_jitter()
vtdb


gmbecker/recordr documentation built on May 24, 2021, 10:59 a.m.