

Let’s say that you want to import an Excel file into R (where the Excel file name is ‘Products’). To start using the package installed, you’ll need to load it in the R Editor.įor instance, to load the readxl package, you’ll have to use: library("readxl") 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") libPaths('X://Users/username/R/win-library/X.> Step 2: Type the command to install the package Finally, I tried to move the personal library location to my users' directory. Removed the whole R\win-library tree and recreated it and nothing. I suspected of directory permissions, checked it within the directories' "properties" without luck.
R STUDIO INSTALL PACKAGE UPDATE
I was getting this same cannot open file error when trying to install or update packages, even when running as administrator. You can get the exact location on your machine with this command in the R console: Sys.getenv('R_LIBS_USER') Therefore, by default, the personal library location is under X:\\Users\username\Documents\R\win-library\X.Y\.

This is because there is no concept of HOME in Windows, just of a "personal" directory (Documents):
R STUDIO INSTALL PACKAGE WINDOWS
The default location for R's user "home" directory on Windows is X:\\Users\username\Documents. files from Documents to the user profile directory. Note: after this change, you may need to move your.
R STUDIO INSTALL PACKAGE HOW TO
Here is a nice guide of how to set environment variables in Windows. To make it permanent, I set a user environment variable R_USER to %USERPROFILE%. Other answers haven't worked.įor me, what solved the problem was to put the personal library directly under X:\\Users\username\ instead of under Documents, which is the R default on Windows. I don't know if the system itself processes its permissions differently or if antiviruses target operations inside this directory more strictly, but many R users have issues installing packages in the personal library inside this folder (even if running R as administrator).

The "Documents" (or "My Documents") directory is a special location in Windows. I'm not sure if this missing folder is the issue, as the error says 'Permission denied', but it seems odd. file142032c9327b is now in the correct path, but path specified in the error is only correct up to /boost, there is no function folder here.? I have changed the directory/libpath as it did not appear that the file was downloading to the correct folder. >Error in install.packages : cannot open file '\\xxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3/file142032c9327b/BH/include/boost/function/detail/gen_maybe_': Permission denied This is the error: >Installing package into ‘\\xxxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3’Ĭontent type 'application/zip' length 16150075 bytes (15.4 MB)Ĭontent type 'application/zip' length 2556205 bytes (2.4 MB) It seems there are various parts to the install, some of these worked but the problem happens when I get 'the dependency BH'. I have installed various other packages without problem but have hit a problem with this. I'm working in RStudio and am attempting to install the dplyr package.
