SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: Does the R code chunk know what is generated? [ reply ]
By: Sigbert Klinke on 2016-11-17 10:54
[forum:43692]
Well, I guess then it is better to use a switch in the LaTeX template file because we know what we want to generate. Thanks a lot nevertheless Sigbert

RE: Does the R code chunk know what is generated? [ reply ]
By: Achim Zeileis on 2016-11-14 22:22
[forum:43685]
This question is not completely easy to answer because there is often a sequence of interfaces calling each other, e.g., exams2nops() calls exams2pdf() which calls xexams(). And if you write your own wrapper function this will be added on top...

However, I just have made a few tweaks to the package here on R-Forge that gives you the calling function by default. Alternatively, you can get the call sequence or even the full calls. To try this out run:

install.packages("exams", repos="http://R-Forge.R-project.org")

And then you can check out

example("match_exams_call", package = "exams")

To see how it works you can also include something like the following into one of your exercises:

This is generated by \textbf{\Sexpr{match_exams_call()}}.

But I would recommend to use the feature with care. Let me know if you encounter any problems. A more robust approach would probably be to have multiple copies of the exercise that are geared towards different processing functions.

Hope that helps!

Does the R code chunk know what is generated? [ reply ]
By: Sigbert Klinke on 2016-11-14 08:22
[forum:43680]
Hi,

I would like to have a different behaviour of my R code if PDF or Moodle output is generated. Does the R code chunk know what kind of output is generated?

Thanks in advance Sigbert

Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge