diff --git a/.Rbuildignore b/.Rbuildignore index 4ef4e99..8ec4dba 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,5 @@ ^paper$ .github ^_pkgdown\.yaml$ +^doc$ +^Meta$ diff --git a/.gitignore b/.gitignore index fb8ad83..812dc62 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ Thumbs.db ~ .Rproj.user .Rhistory +/doc/ +/Meta/ diff --git a/DESCRIPTION b/DESCRIPTION index 298128f..a048f88 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: simpleCache -Version: 0.4.1 -Date: 2019-02-26 +Version: 0.4.2 +Date: 2021-04-16 Title: Simply Caching R Objects Description: Provides intuitive functions for caching R objects, encouraging reproducible, restartable, and distributed R analysis. The user selects a @@ -15,11 +15,12 @@ Authors@R: c(person("VP", "Nagraj", email = "vpnagraj@virginia.edu", role = role = c("aut", "cre"))) Suggests: knitr, + rmarkdown, testthat Enhances: batchtools VignetteBuilder: knitr License: BSD_2_clause + file LICENSE Encoding: UTF-8 -URL: https://www.github.com/databio/simpleCache -BugReports: https://www.github.com/databio/simpleCache -RoxygenNote: 6.1.1 +URL: https://github.com/databio/simpleCache +BugReports: https://github.com/databio/simpleCache +RoxygenNote: 7.1.1 diff --git a/NEWS.md b/NEWS.md index 6fd7f24..018f25e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,10 @@ # Change log All notable changes to this project will be documented in this file. +## simpleCache [0.4.2] -- 2021-04-16 + + - updates to accommodate latest knitr for vignettes + ## simpleCache [0.4.1] -- 2019-02-26 - fixes unit tests on windows diff --git a/R/utility.R b/R/utility.R index e3b1992..2e19d48 100644 --- a/R/utility.R +++ b/R/utility.R @@ -51,24 +51,26 @@ secToTime = function(timeInSec) { sprintf("%02.01f", signif(sec, 3)), "s")) } +ticTocEnv = new.env() + #' Start a timer #' @param gcFirst Garbage Collect before starting the timer? #' @param type Type of time to return, #' can be 'elapsed', 'user.self', or 'sys.self' tic = function(gcFirst = TRUE, type=c("elapsed", "user.self", "sys.self")) { type <- match.arg(type) - assign(".type_simpleCache", type, envir=baseenv()) + assign(".type_simpleCache", type, envir=ticTocEnv) if(gcFirst) gc(FALSE) tic <- proc.time()[type] - assign(".tic_simpleCache", tic, envir=baseenv()) + assign(".tic_simpleCache", tic, envir=ticTocEnv) invisible(tic) } #' Check the time since the current timer was started with tic() toc = function() { - type <- get(".type_simpleCache", envir=baseenv()) + type <- get(".type_simpleCache", envir=ticTocEnv) toc <- proc.time()[type] - tic <- get(".tic_simpleCache", envir=baseenv()) + tic <- get(".tic_simpleCache", envir=ticTocEnv) timeInSec = as.numeric(toc-tic); message("<", secToTime(timeInSec), ">", appendLF=FALSE) invisible(toc) diff --git a/man/simpleCache-package.Rd b/man/simpleCache-package.Rd index 5d34032..edd24d0 100644 --- a/man/simpleCache-package.Rd +++ b/man/simpleCache-package.Rd @@ -22,8 +22,8 @@ Provides intuitive functions for caching R objects, encouraging \seealso{ Useful links: \itemize{ - \item \url{https://www.github.com/databio/simpleCache} - \item Report bugs at \url{https://www.github.com/databio/simpleCache} + \item \url{https://github.com/databio/simpleCache} + \item Report bugs at \url{https://github.com/databio/simpleCache} } } diff --git a/man/simpleCache.Rd b/man/simpleCache.Rd index b4d2ce9..d231db1 100644 --- a/man/simpleCache.Rd +++ b/man/simpleCache.Rd @@ -4,14 +4,27 @@ \alias{simpleCache} \title{Create a new cache or load a previously created cache.} \usage{ -simpleCache(cacheName, instruction = NULL, buildEnvir = NULL, - reload = FALSE, recreate = FALSE, noload = FALSE, - cacheDir = getCacheDir(), cacheSubDir = NULL, timer = FALSE, - buildDir = getOption("RBUILD.DIR"), assignToVariable = NULL, +simpleCache( + cacheName, + instruction = NULL, + buildEnvir = NULL, + reload = FALSE, + recreate = FALSE, + noload = FALSE, + cacheDir = getCacheDir(), + cacheSubDir = NULL, + timer = FALSE, + buildDir = getOption("RBUILD.DIR"), + assignToVariable = NULL, loadEnvir = parent.frame(), - searchEnvir = getOption("SIMPLECACHE.ENV"), nofail = FALSE, - batchRegistry = NULL, batchResources = NULL, pepSettings = NULL, - ignoreLock = FALSE, lifespan = NULL) + searchEnvir = getOption("SIMPLECACHE.ENV"), + nofail = FALSE, + batchRegistry = NULL, + batchResources = NULL, + pepSettings = NULL, + ignoreLock = FALSE, + lifespan = NULL +) } \arguments{ \item{cacheName}{A character vector for a unique name for the cache. Be careful.} diff --git a/man/storeCache.Rd b/man/storeCache.Rd index 3f5bfe3..0d2a773 100644 --- a/man/storeCache.Rd +++ b/man/storeCache.Rd @@ -4,8 +4,12 @@ \alias{storeCache} \title{Stores as a cache an already-produced R object} \usage{ -storeCache(cacheName, cacheDir = getCacheDir(), cacheSubDir = NULL, - recreate = FALSE) +storeCache( + cacheName, + cacheDir = getCacheDir(), + cacheSubDir = NULL, + recreate = FALSE +) } \arguments{ \item{cacheName}{Unique name for the cache (and R object to be cached).}