Loading an R Package from a Custom directory

后端 未结 5 2098
温柔的废话
温柔的废话 2020-12-25 12:57

If I download an \"package-name\".tar.gz file from CRAN website, gunzip and untar it into a custom directory, how do I load that package from within R? I cannot extract the

5条回答
  •  长情又很酷
    2020-12-25 13:39

    You need to install the package to a directory to which you have permission to read and write. First, download the package to an easily accessible directory. If you're on Linux/Mac, try creating a directory called 'rlib' in your home directory.

    cd ~; mkdir rlib
    R CMD INSTALL MSBVAR.tar.gz --library=rlib
    

    If you would prefer to install the package from R, do this:

    ## From CRAN
    install.packages("MSBVAR", lib="~/rlib")
    

提交回复
热议问题