Installing older version of R package

前端 未结 7 1696
梦毁少年i
梦毁少年i 2020-11-22 11:06

I am trying to use Rpy2 and ggplot2 but I get an error. After some searching for the error online, I found that the error occurs because there are changes in the ggplot2 pac

7条回答
  •  庸人自扰
    2020-11-22 11:47

    Pure install.packages method

    See this thread on the r-devel mailing list. In reply to Kurt Wheeler, Kurt Hornik reveals an undocumented feature of the CRAN website to specify the specific version of a package.

    This method will work as long as you have all required dependencies already installed:

    package = "https://cran.r-project.org/package=svglite&version=1.2.1"
    utils::install.packages(pkgs = package, repos = NULL)
    

    Note the URL structure above. This addresses the issue that CRAN has a different URL structure for the latest version than for archived versions:

    # Latest version (not available at Archive/svglite)
    https://cran.r-project.org/src/contrib/svglite_1.2.1.tar.gz
    # Archived version
    https://cran.r-project.org/src/contrib/Archive/svglite/svglite_1.2.0.tar.gz
    

    remotes::install_version method

    Another option is to use the remotes::install_version function. However, you will need to install the remotes package.

提交回复
热议问题