# Has Anyone Used RCall with \`renv\`?

**URL:** <https://discourse.julialang.org/t/has-anyone-used-rcall-with-renv/76310>\
**Category:** Tooling\
**Tags:** packages, interoperability, rcall\
**Created:** [February 12, 2022, 6:03pm UTC](https://discourse.julialang.org/t/has-anyone-used-rcall-with-renv/76310 "2022-02-12T18:03:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [February 12, 2022, 6:03pm UTC](https://discourse.julialang.org/t/has-anyone-used-rcall-with-renv/76310/1 "2022-02-12T18:03:17Z")

</div>

Hi all!

Just was wondering if anyone has had any luck with using `renv` with RCall.  
In R, I use `renv` to manage my package versions per project (very similar to lock files in Julia) and usually you can activate `renv` easily at start-up of the R REPL.  
Anyone have any experiences that they could share on using these tools together?  
Thank you!

~ tcp 🌳

---

<div class="post-metadata">

**Author:** ![swt30](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swt30/32/4667_2.png) [@swt30](https://discourse.julialang.org/u/swt30)\
**Post date:** [February 14, 2022, 4:43pm UTC](https://discourse.julialang.org/t/has-anyone-used-rcall-with-renv/76310/2 "2022-02-14T16:43:33Z")

</div>

I found that the combination of the two just worked. `renv` hooks into the REPL by creating a .Rprofile file in your working directory. RCall reads that .Rprofile when you first run `using RCall`, so renv gets activated as expected. You can run commands like `renv::status()` and `renv::install()` through the dollar-sign shell mode or by running R command strings like `R"renv::status()"`. And if it doesn’t get activated for some reason, you can run the activation script manually with `source("renv/activate.R")`.

Here’s what my workflow looked like:

```julia
# start julia in workdir with julia --project=.
julia> import Pkg; Pkg.add("RCall")
julia> using RCall
# $ activates R repl mode
R> renv::init()
R> renv::install('tidyverse')
R> library(tidyr)
# have at it
# upon restarting the julia repl, `using RCall` will activate renv again

```

---

<div class="post-metadata">

**Author:** ![swt30](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swt30/32/4667_2.png) [@swt30](https://discourse.julialang.org/u/swt30)\
**Post date:** [February 14, 2022, 4:45pm UTC](https://discourse.julialang.org/t/has-anyone-used-rcall-with-renv/76310/3 "2022-02-14T16:45:20Z")

</div>

Oh, you need renv installed system-wide for that to work, but that’s how I have my R environment set up anyway. renv is the only thing I have installed system-wide and I do everything else in renv projects.
