rand_seed: An unevaluated expression to return .Random.seed if exists

Description Usage Details References Examples

Description

This expression returns .Random.seed when eval(rand_seed) and NULL otherwise.

Usage

1

Details

It is designed to work with opts_chunk$set(cache.extra = rand_seed) for reproducibility of chunks that involve with random number generation. See references.

References

https://yihui.name/knitr/demo/cache/

Examples

1
2
3
eval(rand_seed)
rnorm(1)  # .Random.seed is created (or modified)
eval(rand_seed)

yihui/knitr documentation built on Dec. 14, 2018, 6:22 p.m.