Skip to content

Commit

Permalink
Merge pull request #47 from databio/dev
Browse files Browse the repository at this point in the history
Release 0.4.2
  • Loading branch information
nsheff committed Apr 19, 2021
2 parents 0164779 + 328f16d commit 806f818
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Expand Up @@ -6,3 +6,5 @@
^paper$
.github
^_pkgdown\.yaml$
^doc$
^Meta$
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -47,3 +47,5 @@ Thumbs.db
~
.Rproj.user
.Rhistory
/doc/
/Meta/
11 changes: 6 additions & 5 deletions 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
Expand All @@ -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
4 changes: 4 additions & 0 deletions 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
Expand Down
10 changes: 6 additions & 4 deletions R/utility.R
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions man/simpleCache-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions man/simpleCache.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions man/storeCache.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 806f818

Please sign in to comment.