Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache function script #15

Open
vreuter opened this issue Sep 2, 2017 · 1 comment
Open

Cache function script #15

vreuter opened this issue Sep 2, 2017 · 1 comment

Comments

@vreuter
Copy link
Member

vreuter commented Sep 2, 2017

I've wrapped some simpleCache calls in functions so that I can reuse a cache across scripts without assuming (with loadCaches) that a cache already exists while also trying to avoid duplication of the code responsible for creating the cache. This exploits the hook provided by the fact that projectInit sources the 00-init.R file but does so at the cost of cluttering that file. It'd be cool to have a similar hook for cache creation functions. Pragmatically, modestly related to databio/simpleCache#18

@nsheff
Copy link
Member

nsheff commented Sep 2, 2017

Right, exactly what buildDir was originally intended to do. In this setting, you specify a directory, and then just provide a file with the same name as the cache, and that's where your instructions are.

So, not a function, but a file, but otherwise, exactly what you're saying. You could make your buildDir to be src/build-caches and then have a file:

src/build-caches/aggregateData.R

Then simpleCache("aggregateDate.R") will automatically check in src/build-caches/aggregateData.R since you did not provide an instruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants