r - Knitr: how to update chunk options? -


i add chunk option, add_graph, that, if true, appends string link figure caption. (really, want use latex attachfile package include separate copy of graph within caption thereof.) based on example knitr book, thought following work, doesn't.

hook_plot <- knit_hooks$get('plot') knit_hooks$set(plot=function(x, options){    if(!is.null(cap <- options$fig.cap)){       if(options$add_graph){          opts_chunk$set(fig.cap = paste(cap, "link."))       }    }    hook_plot(x, options) }) 

a subsequent chunk chunk option add_graph=true , fig.cap produce plot, nothing appended caption.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -