0

I am working on a replication file and am trying to figure out how to properly use "renv". I've read the documentation, but I'm still a bit confused on how to actualize this. After initializing via

renv::init()

I know I upload packages and work as normal, does

renv::snapshot()

then just need to be called at the end of the document?

ZR8
  • 131
  • 1
  • 9

1 Answers1

0

I wouldn't use renv::snapshot() within a document. When working on a project, you might discover that you have to install new packages from the command line using renv::install().

Then, run your script again, and see if anything breaks, e.g. due to incompatible package versions or compiler errors.

If everything works, you know you have a constellation of packages and versions that work well together. If that's the case, call renv::snapshot() manually to store your current config in the lock file.

If not, use renv::restore() to go back to the previous working configuration, and figure out how to make things work, e.g. by checking different versions of the new package you need.

user11130854
  • 333
  • 2
  • 9