Using more than one version

I'm using two different version of R package in my R programs. Could you pls. let me know how I can make sure that each program uses the correct R package that it is supposed to use? Is there a simple way to do this? I don't want to run into errors and so want to make sure when I try to run both the programs simultaneously. Thanks!

I suppose currently each of your R package live in its own library ?

If pkgVersion1 is installed in library/v1 and pkgVersion2 is installed in library/V2, you could point to the correct library in your different project: library(pkgVersion1, lib.loc = "library/v1")

However, if you want your project to be standalone working project with their own set of dependencies, I suggest to look at packrat that will help you create and manage a library inside each project so that you have no system dependencies issues.

I wrote shortly about packrat is this topic