remindmodel / remind

REMIND - REgional Model of INvestments and Development
Other
91 stars 123 forks source link

Use the folder from which the R session is started as the renv project folder #1712

Closed dklein-pik closed 2 weeks ago

dklein-pik commented 2 weeks ago

Purpose of this PR

Fixing https://github.com/remindmodel/development_issues/issues/305

The .Rprofile always sets the renv project folder to the folder from which the R session is stared. Prerequisite: the folder needs to contain the .Rprofile. Result: if started in a run folder, renv uses the renv-library from the run folder and not from the REMIND main folder.

cd /p/tmp/dklein/remind-renvtest/
Rscript -e "setwd('output/testOneRegi'); system('Rscript -e \"renv::project()\"')"
cd output/testOneRegi/
Rscript -e "renv::project()"

Both return [1] "/p/tmp/dklein/remind-renvtest/output/testOneRegi"

Type of change

Checklist:

Further information (optional):

dklein-pik commented 2 weeks ago

The solution looks embarrassingly simple. But it was hard to figure what happens. Thank you Oli and Pascal, and sorry for the inconvenience.

orichters commented 2 weeks ago

Thanks for fixing it!