How to cache cubes for reading through two (or more) files?

I want to use some R code in two different * .Rnw files and want to use caching through these files. I read http://yihui.name/knitr/demo/externalization/

Caching in a single file just works fine. But running the second one, all the code will be executed again:

plain.R

## @knitr random1
a <- rnorm(10)
a

doc1.Rnw (and doc2.Rnw)

\documentclass{article}

<<set-options, echo=FALSE, cache=FALSE>>=
 options(replace.assign=TRUE)
 opts_chunk$set(external=TRUE, cache=TRUE, echo=FALSE, fig=TRUE)
 read_chunk('plain.R')
@

\title{Doc 1}

\begin{document}

<<random1>>=
@

\end{document}

Is there a way to share the cache between multiple documents?

0
source share
2 answers

. , , , . , ( 1) getOption('width') ( 3), ( 2).

, .

+1

, . , ....

. , - , ....

0

Source: https://habr.com/ru/post/1542978/


All Articles