Sometimes when installing a package in R programming, you find yourself getting an error message. The “R package installation error: Library is not writable” error message can occur if the system cannot write the package to the proper directory. The most common cause of this error message is a permissions problem, resulting because you do not have permission to write to that directory.
Library Not Writeable – What’s Going On?
The “R package installation error: Library is not writable” error message usually occurs because you do not have permission to write to the directory that the package is being saved to. This is not a problem that occurs within R studio but one that is an issue with your or R studio’s relationship to the operating system. In essence, what R studio is trying to tell you is that the operating system is not allowing it to write the package to the directory it is trying to save it to. More often than not it occurs because you do not personally have the required permission to write to the directory. Now if you are the only user of the computer in question, then you should not be getting this error message. However, if you are not the only user then it is possible that the primary user has set up your permissions to prevent you from saving files to some directories as a way of protecting the system.
How the Library Not Writeable Error Occurs…
Within the windows environment most users seldom have any permissions problems, however, there are three possible ways that this problem can occur. It usually means that some kind of permissions change has been made for the directory in question to protect it from malicious changes. This does not necessarily mean that you are not personally trusted, but it could be a step taken to protect the system against external threats. One possible reason why you do not have permission to save to a particular directory is that the directory itself is protected. Another possibility is that you personally do not have permission within your personal settings to make changes to that directory. The final possibility is that the program you are using, in this case, R studio has been blocked from making changes to this directory as a precaution. In either of these cases, R studio is going to be prevented from installing a new package. Now as a result of this problem it will kick back our error message.
How To Fix This Error
Unlike most error messages fixing the “R package installation error: Library is not writable” error message is not a matter of adjusting the code but of fixing the permissions issue within the operating system. if you have administrator status on the computer you are working on then fixing this problem is a simple matter of going into the security settings for the folder or the program and changing them so that the program can write to that folder. Otherwise, you are going to need to go to someone who does have administrator status and have them update the permissions so that a needed package can be installed. If these settings are sufficiently individualized, then the administrator should be able to install the package for you. In either case, this is not a problem that can be fixed by correcting your code.
While this is not an error message that you are likely to encounter if you do it is a problem that needs to be fixed outside of R studio. More likely than not it is a result of the security settings for the directory that you are sending the package to, being set so as to deny write access to it. If so, fixing it should not be a problem.