# Installing R in Julia

**URL:** <https://discourse.julialang.org/t/installing-r-in-julia/44466>\
**Category:** New to Julia\
**Created:** [August 7, 2020, 12:03am UTC](https://discourse.julialang.org/t/installing-r-in-julia/44466 "2020-08-07T00:03:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauloat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauloat/32/16517_2.png) [@pauloat](https://discourse.julialang.org/u/pauloat)\
**Post date:** [August 7, 2020, 12:03am UTC](https://discourse.julialang.org/t/installing-r-in-julia/44466/1 "2020-08-07T00:03:29Z")

</div>

Hi, im trying to install the package RCall but I’m running in some problem.

for context:

> \>R RHOME  
> /usr/local/lib/R

> \>R --version  
> R version 3.6.3 (2020-02-29) – “Holding the Windsock”

OS: Linux Mint 19

Now, when I do

> Pkg.add(“RCall”)

Have no problem, but when I call it with

> using RCall

I get the next error

> [Info: Precompiling RCall [6f49c342-dc21-5d91-9882-a32aef131414]  
> ERROR: LoadError: RCall not properly installed. Please run Pkg.build(“RCall”)  
> Stacktrace:  
> [1] error(::String) at ./error.jl:33  
> [2] top-level scope at /home/username/.julia/packages/RCall/g7dhB/src/RCall.jl:36  
> [3] include at ./boot.jl:317 [inlined]  
> [4] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [5] include(::Module, ::String) at ./sysimg.jl:29  
> [6] top-level scope at none:2  
> [7] eval at ./boot.jl:319 [inlined]  
> [8] eval(::Expr) at ./client.jl:393  
> [9] top-level scope at ./none:3  
> in expression starting at /home/username/.julia/packages/RCall/g7dhB/src/RCall.jl:33

and when I run

> Pkg.build(“RCall”)

I get the next error

> Conda → `~/.julia/packages/Conda/3rPhK/deps/build.log`  
> Building RCall → `~/.julia/packages/RCall/g7dhB/deps/build.log`  
> ┌ Error: Error building `RCall`:  
> │ ERROR: LoadError: R cannot be found. Set the “R\_HOME” environment variable to re-run Pkg.build(“RCall”).  
> │ Stacktrace:  
> │ [1] error(::String) at ./error.jl:33  
> │ [2] top-level scope at /home/username/.julia/packages/RCall/g7dhB/deps/build.jl:49  
> │ [3] include at ./boot.jl:317 [inlined]  
> │ [4] include\_relative(::Module, ::String) at ./loading.jl:1044  
> │ [5] include(::Module, ::String) at ./sysimg.jl:29  
> │ [6] include(::String) at ./client.jl:392  
> │ [7] top-level scope at none:0  
> │ in expression starting at /home/username/.julia/packages/RCall/g7dhB/deps/build.jl:10  
> └ @ Pkg.Operations /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1096

I try to set the R\_HOME variable to be the same as \>R RHOME with

> ENV[“R\_HOME”] = “/usr/local/lib/R/”

But that give me same error when running Pkg.built(“RCall”).

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 7, 2020, 3:39am UTC](https://discourse.julialang.org/t/installing-r-in-julia/44466/2 "2020-08-07T03:39:09Z")

</div>

> [@pauloat](#):
>
> ENV[“R\_HOME”] = “/usr/local/lib/R/”

hmm, i wonder if setting R\_HOME via bash export would work like

```bash
export R_HOME= "/usr/local/lib/R/"

```

and then start Julia again and run
