A test chapter

library(rebook)
chapterPreamble(cache=TRUE)

Named chunks will be searched by extractCached() to retrieve the requested object:

godzilla <- "RAWR!"

Unnamed chunks will not be searched or reported, so make sure that they are "read-only" with respect to variables in the named chunks; otherwise the code reported by extractCached() will not fully describe the nature of the object.

msg <- "I am hidden from extractCached()"

Similarly, chunk names starting with unref- are ignored. This is useful for read-only chunks that produce figures in the donor chapter (Figure \@ref(fig:unref-figure)) but should not be reported by extractCached().

plot(1:10, 1:10, main="I am also hidden.")

Assignments should be performed using <- (i.e., the correct way). Assignments with = are simply ignored and will not be picked up as objects by extractCached().

godzilla <- "GAO GAO"
ghidorah <- "pew pew"
mothra = "Oh, I'm not in this one." # WRONG!

The same variable can appear multiple times in different chunks; extractCached() will be able to disambiguate the reference by looking for the requested chunk.

godzilla <- "rawr rawr"
mechagodzilla <- "beep beep"
godzilla <- "I'm back."
muto <- "Hi."


Try the rebook package in your browser

Any scripts or data that you put into this service are public.

rebook documentation built on Nov. 8, 2020, 4:56 p.m.