R Install.packages fails with "object not found error"

drezap picture drezap · Jun 10, 2016 · Viewed 16.1k times · Source

I am currently trying to install packages on R. On the startup, I get the normal R message with

"Error: object 'getw' not found"

When I use the install.packages function, I get the same error at the end of the installation, one for each package I tried to install.

However, when I start R with R --no-init-file I can install packages normally.

I have been fishing around with Rprofile and other initialization settings of R. I have also done clean installs of R, and the message still appears.

Does anyone have an idea about how to remove this error? Also, this machine is running Ubuntu 14.04 Trust Tahr.

Answer

RHertel picture RHertel · Jun 10, 2016

This sounds like something is wrong with the .Rprofile file. There can be more than one such file. At the beginning of an R session, R first searches for such a file in the working directory, then in the home directory.

You may also want to check if the environment variable R_PROFILE_USER is set (In an R shell, this can be checked with Sys.getenv("R_PROFILE_USER")). If yes, look at the .Rprofile file in that directory to see if there is any suspicious entry.

If all fails, make a copy of the .Rprofile file in your home directory and (if applicable) in your working directory with a different name. Then delete the file and try the installation again. If this succeeds you can afterwards restore the old .Rprofile file(s) by using the copy/copies that you made before.