Rstudio, windows 10 WSL and changing $PATH

I am using Rstudio on a machine with WIndows 10. I have also installed WSL so I could access some LInux programs, which I have installed outside the default PATH.
Before using a windows machine, my workaround to have RMarkdown chunks using programs installed outside PATH was to add the location of the linux program to the PATH variable, either with an .Rprofile file or an .Renviron file.

With this new setup, however, I am not sure how to proceed. The PATH env variable needs to be in Windows pathways, and it is necessary to load all basic R packages.

  • If I try to change it with usethis::edit_r_environ or edit_r_profile, then it Fails to add base R packages
  • I have changed the Global Options/Terminal so it opens the WSL shell. So now, if I run, within an Rmarkdown chunk
echo $PATH

I get the default $PATH of my WSL, without the addition to the path (included in a .bash_profile )

if I run

source  ~/.bash_profile
echo $PATH

THen it works, but it obviously forgets it on the next chunk

How should I update PATH so ithe computer recognizes it everytime I launch bash WSL from an Rmarkdown?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.