slow_function = function(n) { Sys.sleep(n) # sleep for n secs rnorm(1000) } system.time(slow_function(2))
library(iCacheR) cache_function = ic_cache(slow_function) system.time(t1 <- cache_function(2)) # first use - normal time system.time(t2 <- cache_function(2)) # second - read cached value all(t1 == t2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.