SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: include_supplement problem [ Reply ]
By: Achim Zeileis on 2024-01-30 08:38
[forum:49839]

include_supplement.zip (0) downloads
There are two ways to accomplish this. The recommended one is illustrated in the attached .zip archive.

I would strongly recommend to use unique file names across directories. You need that for the exercise files anyway, hence I would also use it for the static supplementary files stored along with the exercises (which must not be the same as the file name used within the exercise!). So in your case I would store "exercise1-supp.Rmd" along with "exercise1.Rmd" but include it within the exercise as "supp.Rmd" so that the exercise file information is not revealed to the participants.

To do so, rename the supp.Rmd file in the exer1/ directory to exercise1-supp.Rmd and change the include chunk to:

include_supplement("exercise1-supp.Rmd", target = "supp.Rmd", recursive = TRUE)

Then the rest of your exercise file is not affected by this.

Alternatively, you can use the same file names supp.Rmd but replace the recursive=TRUE by dir="exer1" which avoids the searching and finds the file in the correct directory. However, then you cannot process the exercise within the exer1/ directory but must always be in a folder higher up in the hierarchy.

include_supplement problem [ Reply ]
By: Sigbert Klinke on 2024-01-29 10:32
[forum:49838]
Hi,

I have a file/directory structure like

./exercises.R
./exer1/exercise1.Rmd
./exer1/supp.Rmd
./exer2/exercise2.Rmd
./exer2/supp.Rmd

where I pick up in exercises.R all Rmd files in the subdirectories and run them via exams:::browse_exercise(rmdfiles, verbose=TRUE).

However, inside exer1 and exer2 I have a supplement file "supp.Rmd" which I load with include_supplement('supp.Rmd', recursive=TRUE).

When I run "exercises.R" in '.' then .exams_get_internal("xexams_dir_exercises") is '.'. Thus I added 'recursive=TRUE' such that the supplement files can be found.

Unfortunately I have two sligthly different supp.Rmd's and search_file reveals that the wrong one is taken and leads to an error.

Is there a possibility that I can tell include_supplement to search in the directory where the Rmd file is?

Thanks Sigbert

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