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

Helpers to handle local data files and file setup #497

Closed
gadenbuie opened this issue Feb 23, 2021 · 1 comment · Fixed by #539
Closed

Helpers to handle local data files and file setup #497

gadenbuie opened this issue Feb 23, 2021 · 1 comment · Fixed by #539

Comments

@gadenbuie
Copy link
Member

gadenbuie commented Feb 23, 2021

A few options to handle common usage of data files in learnr exercises, such as those described in #99

  1. Make the data/ directory special and copy it into the exercise temp dir
  2. Provide a helper function that knows the absolute path of the data/ dir that can be used in the setup chunk
  3. Provide a chunk option, e.g. exercise.files, that will copy a vector of relative (to tutorial.Rmd) file paths into the exercise temp dir

The problem with all of the above is that it would be very hard to ensure that external evaluation will work correctly without serializing and sending the files with each submission.

@gadenbuie
Copy link
Member Author

We just added a new feature that implements the first option mentioned above. There are now three ways authors can include files for use in exercises:

  1. Store the files in a data/ directory in the same directory as the tutorial.

  2. Use the setup chunk to download or write the files to a data/ directory.

  3. Use the tutorial.data_dir global option or the TUTORIAL_DATA_DIR environment variables to specify a path to a data directory.

More information can be found online in the learnr documentation in Exercises - Using Files in Exercises.

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

Successfully merging a pull request may close this issue.

1 participant