rpackagemicrosoft-r

Install specific package version in Microsoft R Open


How do I install a specific package version in Microsoft R Open (MRO)? I am familiar with the checkpoint("YYYY-MM-DD") function for changing ALL package versions to a specific MRO snapshot. I do not want to do this. I only want to change the version of a single package.


Solution

  • To install a specific version of a package, download the package from the CRAN or MRAN archive (src/contrib/Archive) and install it with

    install.packages("/path/to/pkg/src", type="source")
    

    where/path/to/pkg/src is the path to the downloaded package.

    To get the package directly from a specific MRAN snapshot, use

    install.packages('pkg', repos='https://mran.microsoft.com/snapshot/YYYY-MM-DD/')
    

    To also get the dependencies, you want

    install.packages('pkg', repos='https://mran.microsoft.com/snapshot/YYYY-MM-DD/', dependencies=TRUE)
    

    Be aware, however, that the version you choose may not be compatible with the version of MRO you are using. This is why MRO uses a specific MRAN snapshot--to ensure compatibility of available packages with the specific MRO.