

Step 4: Start using the package installed You may choose a mirror which is closer to your geographic location.

Step 3: Select a Mirror for the installationįor the final step, select a Mirror for the installation. Once you are done typing the command, press ENTER to proceed with the installation. Now you’ll need to use the following template to install your package: install.packages("package_name")įor example, you may type the following command in the R Console in order to install the readxl package: install.packages("readxl") This option does not require any other dependencies.> Step 2: Type the command to install the package Then to load that package, I had to do just this: library(data.table, lib.loc = '~/R/x86_64-pc-linux-gnu-library/4.1') So I ended up with installing the package in ~/R/x86_64-pc-linux-gnu-library/4.1 This will depend from case to case, so pay attention to the messages given by install.packages('data.table') so that you get the right path. To install packages into? (yes/No/cancel) yes Would you like to create a personal library Would you like to use a personal library instead? (yes/No/cancel) yes Warning in install.packages("data.table") : Below, I tried to install it in the default library directory, but I was forced to change that to another directory: install.packages('data.table') In my case, I had to install the package to a custom directory due to admin restrictions. I run into a similar problem and to load an R Package from a custom directory you can also use the lib.loc option of the library() function. Install.packages("/my/dir/",repos=NULL, type="source") Install.packages("MSBVAR", type="source") When building from source, you need to make sure all dependencies are installed as well, or you can get errors.Īpart from the R CMD INSTALL you could try from within R : # from CRAN For the MSBVAR package, these are the packages coda and bit. Plus, you have to take into account that the package you want to install might have dependencies.

There might be underlying C-code (which is the case for the MSBVAR package), and even R code has to be processed in order to be built into a package that can be loaded directly with the library() function. See that website for more information on how to install everything you need.Įven when you're on Linux, simply extracting the package-file doesn't work. If you're on windows, you need Rtools ( ) to build from source. Please add some extra information on the operating system.
