how to properly activate renv using console in R project?

49 Views Asked by At

I am confused with proper steps to activate renv. The project is currently scheduled and working fine with renv using task scheduler.

But I need to do some modifications, so I opened project in R studio. First step I am manually activating renv in a console: renv::activate(). But it gives me an error:

Error in loadNamespace(x) : there is no package called ‘renv’

getwd() gives me a path to my project where renv folder located.

"C:/Users/myusername/R/myProject"

What am I doing wrong that constantly gives me this error?

What am I missing in understanding how renv works?

Is that correct to view it same as venv in python?

.libPaths()
# [1] "C:/Users/myusername/R/MyProject/renv/library/R-4.3/x86_64-w64-mingw32"
# [2] "C:/Users/myusername/AppData/Local/R/cache/R/renv/sandbox/R-4.3/x86_64-w64-mingw32/1e360f03" 

dir.exists(file.path(.libPaths(), "renv"))
# [1]  TRUE FALSE
0

There are 0 best solutions below