The ClassTools package has a set of functions that are useful for downloading material related to classes from GitHub. This package should forked to create a package that is designed for a particular class. All material for a specific class should be put in the ClassMaterial directory. Additional R code useful for specific classes can be added to the R/ directory.
This package should not be installed. Instead it should be forked from GitHub.
Here are directions on how to make the necessary changes to turn the ClassTools package into a class specific package:
1) Fork ClassTools repository to a new GitHub repo. Here are directions on how to fork my own package: https://deanmalone.net/post/how-to-fork-your-own-repo-on-github/
2) In the DESCRIPTION file rename the package
3) Rename the ClassTools.RProj file
4) In get_package_and_url_names.R change the package_name variable
5) In testthat/testthat.R change library(ClassTools) and test_check(“ClassTools”)
6) Push changes to GitHub and run devtools::test()
7) Edit the Readme.Rmd to list information relevant to the class
Here is an example of a forked package used in a class: https://github.com/emeyers/SDS230
How homework should be R Markdown files put in the
ClassMaterial/homework directory. Homework should be named
homework_XX.Rmd
, where XX
is a two digit number. For example, the
first homework should be called homework_01.Rmd
. Once a homework file
is created students can download it using the code below.
# download the first homework
download_homework(1)
New functions can be added to the package mid-semester by adding new .R
files to the R/ directory. One should also update the version number in
the DESCRIPTION file so that one can check that the updates have taken
place. Students can then update the class package to have access to
these function by running the reinstall_package()
function.
# reinstall the package from GitHub to contain updated functions.
reinstall_package()
A list of packages that students should have installed is in the file
ClassMaterial/required_package.txt. Package names should be on new
lines separated by commas (similar to how they are listed in the Imports
line of the DESCRIPTION file). Students can then install all the
required class packages using the update_installed_packages()
function
# install any packages used in the class
update_installed_packages()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.