2

My knitr document consists of a single chunk which loops a parameterized child RMD into a long string object, out, using the knitr::knit_child() function. Next the out object is pasted verbatim as:

`r paste(out, collapse='\n')`

Is it possible for knitr to index the chunks in the child RMDs? For example, if the same chunk name is used repeatedly: map, map, map, ... could knitr automatically append the chunk names: map, map-1, map-2, ..., map-n?

As it stands, each iteration overwrites the chunk. Thus the content reflects only the last iteration. Not using labels is an effective stop-gap but doing so prevents the handy use of reference R scripts for the children.

RTS
  • 882
  • 1
  • 8
  • 13
  • Possible duplicate of [R knitr: Possible to programmatically modify chunk labels?](https://stackoverflow.com/questions/12095113/r-knitr-possible-to-programmatically-modify-chunk-labels) – Martin Schmelzer Mar 28 '18 at 20:54

0 Answers0