work_with_cache: (Experimental) Work with the package cache

View source: R/utils-renv.R

work_with_cacheR Documentation

(Experimental) Work with the package cache

Description

This function is designed so that you can work on your lesson inside the package cache without overwriting your personal library.

Usage

work_with_cache(profile = "lesson-requirements")

Value

a function that will reset your R environment to its original state

Examples

if (interactive() && fs::dir_exists("episodes")) {
  library("sandpaper")
  done <- work_with_cache()
  print(.libPaths())
  # install.packages("cowsay") # install cowsay to your lesson cache
  # cowsay::say() # hello world
  # detach('package:cowsay') # detach the package from your current session
  done() # finish the session
  # try(cowsay::say()) # this fails because it's not in your global library
  print(.libPaths())
}

zkamvar/sandpaper documentation built on April 21, 2024, 1:17 a.m.