Controlling R package versions, and using Docker (e.g. with Rocker images) to control the underlying OS librairies, can help solve this. (You'd need a virtual machine to control more, such as the OS kernel). This and some other options are discussed here.