I recommend you to separate different functions apart: let a device
function only open a device, and let chunk hooks do the job of
executing R code before/after the chunk, e.g.
<<par-hook>>=
knit_hooks$set(par = function(before, options, envir) {
if (!before) return()
pars <- opts_current$get(c('bty', 'las'))
do.call(par, pars)
})
@
<<plot-par, par=TRUE, bty=l, las=2>>=
plot(rnorm(100))
@
Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA
Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA