Some R packages do not update with update.packages()

Viewed 15263

Selecting Packages->Update packages... gave:

> update.packages(ask='graphics',checkBuilt=TRUE)
--- Please select a CRAN mirror for use in this session ---
Warning: package 'foreign' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated
Warning: package 'lattice' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated
Warning: package 'Matrix' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated
Warning: package 'nlme' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated
Warning: package 'rpart' in library 'C:/Program Files/R/R-3.0.2/library' will not be updated

I ran the R shortcut in the startup menu "as Administrator" and got the same results.

R version is 3.0.2.

5 Answers

On R 4.0.4 (Gallium OS 3.1)

Permissions? old.packages() ?

In my case, I noticed 3 packages that would not update had permissions set differently from others in /usr/local/lib/R/library.

I fixed the permissions, but this did not solve the problem.

Then I ran old.packages() and noted the SAME 3 packages were considered old.

I admit I did not quite understand the help in ?update.packages(), but tried the following.

update.packages(oldPkgs = old.packages())

This fixed the problem and the 3 packages updated.

In my case worked the following command sequence in the Terminal of Ubuntu:

sudo i-
R
update.packages(ask=FALSE)
q(save="no")
logout

That is to say: loging as root -> starting R -> updating packages from root -> out of R -> out of root.

Related