Can I run multiple R version in a single R script. If yes, what are the syntax.

Description of issue -

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version:
  • OS Version:
  • R Version:
  • sessionInfo():

Referred here from support.rstudio.com

No, there is no easy way to do that. I'm not sure if there is a complicated version, other than creating multiple Docker containers with different versions and creating some convoluted process.

But why do you need this?

Actually there is a ROsiPi package which has only support for R 3.4
If I want to use that, then I require R to be running on 3.4 for some of the lines in my R script.
Can I do it via Doccer?

Docker is an external program that is not connected to R in any way. You can learn about it here - https://www.docker.com/.

My first attempt would be to find a way to do it with modern versions of R or even another language (Python, for example). If that's not possible, then Docker solution might be to start a service in a container running R 3.4 and which is exposed via Plumber, for example. Then in your script you can call it as you would call any other external API.

If that sounds complicated it's because it is. Perhaps, there are easier solutions, but that's the approach I would take.

1 Like