### Name: example ### Title: Run an Examples Section from the Online Help ### Aliases: example ### Keywords: documentation utilities ### ** Examples example(InsectSprays) ## force use of the standard package 'stats': example("smooth", package="stats", lib.loc=.Library) ## set RNG *before* example as when R CMD check is run: r1 <- example(quantile, setRNG = TRUE) x1 <- rnorm(1) u <- runif(1) ## identical random numbers r2 <- example(quantile, setRNG = TRUE) x2 <- rnorm(1) stopifnot(identical(r1, r2)) ## but x1 and x2 differ since the RNG state from before example() ## differs and is restored! x1; x2