Browse Source

cinc prep

master
boB Rudis 4 years ago
parent
commit
f214586d94
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 7
      DESCRIPTION
  2. 2
      R/cache-kb.R
  3. 9
      README.Rmd
  4. 7
      README.md
  5. 2
      man/cache_kb_self.Rd

7
DESCRIPTION

@ -16,11 +16,12 @@ BugReports: https://git.rud.is/hrbrmstr/kbmemoise/issues
Encoding: UTF-8
License: MIT + file LICENSE
Suggests:
covr, tinytest
covr
Depends:
R (>= 3.5.0)
Imports:
httr,
jsonlite
memoise,
digest,
tinytest
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0

2
R/cache-kb.R

@ -68,6 +68,7 @@ cache_kb <- function(cache_path, algo = "sha512") {
#' for available algorithms.
#' @export
#' @examples
#' if (tinytest::at_home()) {
#' kbc <- cache_kb_self(".cache")
#'
#' kbc$location()
@ -84,6 +85,7 @@ cache_kb <- function(cache_path, algo = "sha512") {
#' kbc$reset()
#'
#' kbc$size()
#' }
cache_kb_self <- function(cache_subdir, private = TRUE, algo = "sha512") {
me <- system2(kbexec(), "whoami", stdout = TRUE)

9
README.Rmd

@ -39,23 +39,30 @@ packageVersion("kbmemoise")
```
```{r ex-01}
```{r ex-01, eval=FALSE}
kbc <- cache_kb_self(".cache")
kbc$location()
## [1] "/Volumes/Keybase/private/hrbrmstr/.cache"
mrunif <- memoise::memoise(runif, cache = kbc)
mrunif(10) # First run, saves cache
## [1] 0.5687944 0.5739892 0.4309080 0.1959454 0.7240059 0.4751237 0.4049415 0.6617540 0.7025730 0.9428181
mrunif(10) # Loads cache, results should be identical
## [1] 0.5687944 0.5739892 0.4309080 0.1959454 0.7240059 0.4751237 0.4049415 0.6617540 0.7025730 0.9428181
kbc$keys()
## [1] "abb4b2ca91214fd892622aa50f4f5dc98d1453ae577cd916e60e02ebda8bbe7d75ff93d1fdd81967edced64de89833361e7f150cfae4898acb70b1aac932e791"
kbc$size()
## [1] 0
kbc$reset()
kbc$size()
## [1] 0
```
## kbmemoise Metrics

7
README.md

@ -42,6 +42,8 @@ remotes::install_git("https://git.sr.ht/~hrbrmstr/kbmemoise")
remotes::install_gitlab("hrbrmstr/kbmemoise")
# or
remotes::install_bitbucket("hrbrmstr/kbmemoise")
# or
remotes::install_github("hrbrmstr/kbmemoise")
```
NOTE: To use the ‘remotes’ install options you will need to have the
@ -67,6 +69,7 @@ mrunif <- memoise::memoise(runif, cache = kbc)
mrunif(10) # First run, saves cache
## [1] 0.5687944 0.5739892 0.4309080 0.1959454 0.7240059 0.4751237 0.4049415 0.6617540 0.7025730 0.9428181
mrunif(10) # Loads cache, results should be identical
## [1] 0.5687944 0.5739892 0.4309080 0.1959454 0.7240059 0.4751237 0.4049415 0.6617540 0.7025730 0.9428181
@ -86,8 +89,8 @@ kbc$size()
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 5 | 0.83 | 97 | 0.85 | 33 | 0.59 | 89 | 0.75 |
| Rmd | 1 | 0.17 | 17 | 0.15 | 23 | 0.41 | 30 | 0.25 |
| R | 5 | 0.83 | 97 | 0.85 | 33 | 0.58 | 91 | 0.72 |
| Rmd | 1 | 0.17 | 17 | 0.15 | 24 | 0.42 | 36 | 0.28 |
## Code of Conduct

2
man/cache_kb_self.Rd

@ -26,6 +26,7 @@ provided in slots in the returned list:
}
}
\examples{
if (tinytest::at_home()) {
kbc <- cache_kb_self(".cache")
kbc$location()
@ -43,3 +44,4 @@ kbc$reset()
kbc$size()
}
}

Loading…
Cancel
Save