Created
August 5, 2016 14:37
-
-
Save alekrutkowski/1770cba4a9ecb8e2e55354bad3917914 to your computer and use it in GitHub Desktop.
cachedCall&Assign for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(cacheflow) # https://github.com/alekrutkowski/cacheflow | |
CCA <- function(FUN,...) | |
## cachedCall&Assign | |
## A macro to avoid repetitive typing like | |
## myX_result <- cachedCall(myX_function, ...) | |
## creates and object `.myX` to avoid overwriting function `myX` | |
## that still may be used in the subsequent cachedCall/CCA calls | |
## i.e. | |
## CCA(myX, ...) | |
## is an equivalent of | |
## .myX <- cachedCall(myX, ...) | |
assign(paste0('.',deparse(substitute(FUN))), | |
eval(bquote(cachedCall(.(substitute(FUN)),...))), | |
envir=parent.frame()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment