0

I'm working through Renv and how it works. I was wondering how the workflow is when I start a new project and install a project from gitlab which itself contains an renv configuration.

Is there a way to copy this renv for my new project without manually downloading it? If so, how to deal with multiple packages having a renv. Is there any functionality that checks for package version mismatches? I mean, I start a new project let's call it A, which depends on B and C. Both B and C have a renv configured which I would like to merge. I guess I have to do this manually - am I right?

Would conda be the better choice?

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Ai4l2s
  • 525
  • 2
  • 9
  • Here's what I would do. After installing from GitLab, execute `renv::init()`. Then choose option 2: Discard the lockfile and re-initialize the project. I also tried `renv::restore()`, but `renv::init()` ended up being the better option. – Ted M. Sep 15 '22 at 21:05

1 Answers1

0

see the vignette on collaboration for your first two questions - i.e. if you have a project with renv already, use renv::restore(), if it does not have renv yet, use renv::init(). For using the same renv in a second project, I would initialise the second project with renv::init() but then replace the lockfile with the file from the first project, and run renv::restore to install the packages from the pasted lockfile. I am not aware of a tool that does dependency resolution (i.e. your question about packages A, B, C) in R, but would be delighted if someone could point me towards one (here's where I still prefer python, with e.g. pipenv)

gira
  • 175
  • 6