Your RMarkdown file should be in its own directory (with no other .Rmd
files).
renv
Install renv
using the instructions on the RStudio site (if not already installed)
Navigate to the directory where your Rmd file is located and initialize a new renv project.
setwd("path/to/directory")
renv::init()
IRkernel is necessary for Pathbird to run your notebook.
renv::settings$snapshot.type("all")
renv::install("IRkernel")
renv::snapshot()
# note: you do NOT need to run IRkernel::installspec() here
<aside> 💡 Even though you won't use IRkernel while developing your lesson it must be installed (since Pathbird uses IRkernel to run student code). Pathbird can't install it automatically since it might accidentally upgrade one of the dependencies of your project.
</aside>
<aside>
👉 IMPORTANT: Make sure to run the renv::settings$snapshot.type("all")
command. This tells renv to record all of the dependencies, not just the ones you directly use in your R code. This is important to ensure that renv keeps track of the IRkernel
dependency.
</aside>
You can install any packages (using either renv::install
or install.packages
) and write your R code as normal. Remember to save your environment (by running renv::snapshot()
) after installing new packages.
See the Codex syntax reference for a reference on how to add Pathbird-specific directives into your file.
Make sure your renv
snapshot mode is set to all
and that you've installed IRkernel
into your project:
renv::settings$snapshot.type("all")
install.packages("IRkernel")