knitr   414

« earlier    

knitr: Use an inline expression in fig.cap chunk option - Stack Overflow
fig.cap is evaluated as an R expression, so instead of using \rinline (and thus having the caption again parsed by knitr), you can just create the caption string in R.

%% begin.rcode fig.cap=paste("x is", x)

but because fig.cap is evaluated before x is created by default, you will need to postpone the evaluation of fig.cap; to do that, you can include a chunk like this in the beginning of your document:

%% begin.rcode setup, include=FALSE
%% opts_knit$set(eval.after = 'fig.cap')
%% end.rcode

It specifies fig.cap to be evaluated after the code chunk is evaluated, i.e. when x is available for you to use in the figure caption. See eval.after in the documentation.

The other way to do this is to create x in a previous chunk, and use fig.cap=paste("x is", x) in the next chunk.
r  markdown  knitr 
9 days ago by jotjotjes
Include Images
```{r out.width = "50%", fig.align = "center"}.


```{r echo=FALSE, out.width='100%'}
rmarkdown  image  knitr 
29 days ago by bikesandbooks
R at the command line -- executable
in the termal:

Rscript.exe -e 'knitr::knit("main.Rmd")'
Rscript.exe -e 'rmarkdown::render("main.Rmd")'
command  line  cli  executable  r  rmd  render  knitr  rmarkdown  from notes
february 2018 by bikesandbooks
Child documents - Input child files into the main document - Yihui Xie | 谢益辉
Rscript.exe -e 'rmarkdown::render(parent.Rmd)'
Rscript.exe -e 'knitr::knit(parent.Rmd)'

*** Absolutely seems to must be done with html_document **** (not html_notebook!!!)
knitr  child  rmarkdown  parent  include  rscript  code  externalization  import  chunk 
february 2018 by bikesandbooks

« earlier    

related tags

academicpapers  analysis  automation  batch  beamer  bestpractice  blog  cache  charts  child  chunk  chunks  cli  code  command  control  converter  csv  data-viz  data  deanattali  docx  ea  emacs  encoding  executable  external  externalization  ezknitr  files  folder  generator  handouts  hmisc  html  ide  ifttt  image  import  include  ipymd  ipynb  jupyter  kable  latex  line  literate.programming  make  markdown  my-question  myrcourse  notebook  notebooks  notes  nutshell  openscience  opensource  org  package  packages  pander  pandoc  parent  pdf  pedagogy  plaintext  podcast  presentations  py  python  r  rebench  render  rep_research  reproducible.reporting  reproducible.research  reproducible  reproducible_research  reproducibleresearch  research  rlang  rmarkdown  rmd  rnw  rprogramming  rscript  rstats  rstudio  sciprog  scrivener  shiny  slides  software-development  spin  sql  style  sweave  table  tables  te_proberen  tex  text  tool  versioncontrol  web-development  web  wordpress  working  xtable  yihui  yui 

Copy this bookmark: