What are best practices for distributing and using files with learnr tutorials?
For example, I have a file, test.csv, which I want to use to teach students about read_csv(). First, what is the best way to ensure that students have a copy of that file? Second, what is the best way to ensure that students can "see" that file for a specific exercise code chunk?
UPDATE: Not sure on the best answer. I decided to stick all such files in inst/www, following the discussion here. Then, I can refer to those files --- consider "test_1.csv" --- with code in the tutorial like:
cat(readLines(paste0(system.file("www/", package = "primer.tutorials"),
"test_1.csv")), sep = "\n")
Can't say I like this, but it works.
The second use case is to put a copy of the file in the working directory of the current question. I do that with a setup chunk which looks like:
file.copy(paste0(system.file("www/", package = "primer.tutorials"),
"test_1.csv"), ".")
Again, it works. But is it really the best way?