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
Specifying options at knit time #19
Comments
all options are at http://yihui.github.com/knitr/options (see I do not think it is a good idea to put options in Basically I want to keep the number of arguments minimal in a function. In my early packages, I used to use The environment variable is even more a disaster; I believe it drags Sweave further away from reproducible research. |
The downside to that is that it pushes people into the box of reproducible, even if the do not want it. Consider creating automated reporting where the data changes. Someone might want to retain all graphics and output for the last month or runs, which could be accomplished very easily with run time global options, but otherwise would require editing the file every time to adjust the single parameter you want changed. |
your pointing me to the objects showed me how to get around this. My makefile rule is now:
which achieves the desired result. I still think that the cache directory should be separable from the figures directory, but I totally agree that the environment variable is messy. On the other hand the setup as now configured almost replicates the environment problem since the options are set in the R environment rather than in the function call. Which mean someone must show the R environment objects when compiled rather than just the function call used to compile. |
In fact the initial design separated the two directories (as I thought on this issue for a long time, and came to a conclusion that we probably should not care about the output figures and cache files. What is most important is usually the final PDF document, so it might not hurt to put all the messy intermediate output files into a single directory. If these two directories are separate, imagine now you have a second Rnw document under the same directory, and you would probably end up with four directories (figure and cache for two Rnw documents respectively), which I believe is messy to manage. Again, I want to keep the number of options minimal; more options mean the user has to memorize more. Since I have a |
simplicity can be combined with power. My gripe was with the fragmentation of setting options, which is why I am grateful for knitr. Unifying the method for specifying options is a good thing, but I'm not sure that I like breaking with the established method of passing along as extra options. On the argument of separating cache and figures, I certainly think that there are reasons for separating them. The most obvious is that for publication, journals want your figures but not your cached intermediate results. Finding, examining, and sharing figures is something that I want to do and do often. sometimes just pulling those out for a separate manuscript. Cache, on the other hand I want to work but be out of sight. It would probably even be a good idea for those directories to be hidden by default. We really are mixing this with issue #20 now. |
Let's focus on this issue and forget about #20. The decision on I'm convinced now on the separation of the cache directory. So you'd like it to be a chunk option as well? (instead of calling something like |
You have chunk option |
prefix.cache works great. Thank you. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Sweave packages can specify options at compile time for certain options that the package supports, such as
creates a tex document and places all figures in the figures directory with fig prefixed to the figure. I see no way to specify this in
knitr
knit maybe could accept extra arguments in the form of
knit(input, output, pattern, ...)
where...
would be used to specify defaults that are then written over for file and chunk options.This is extremely useful for specifying with a Makefile
Which creates a tex file but could also puts graphics in a specific graphics folder which helps with cleanup, and prefixes graphics with the filename stem to prevent naming collisions, very useful with automated reporting.
Preferably, I would like to see knitr accept anything as an option and either silently or with warning discard those not valid or not used by specific blocks.
Also as a note. Original Sweave allowed for options set through SWEAVE_OPTS environment variable, although not all extension packages use this, nor is is used very much be people in general I believe.
The text was updated successfully, but these errors were encountered: