Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R force reinstall packages

I ran the command update.packages(checkBuilt = TRUE, ask = FALSE).

However my html directories were not writable and I got a lot of:

Warning in file.create(f.tg) :
cannot create file '/usr/share/doc/R-3.0.1/html/packages.html', reason 'Permission denied'

Is there a way to force reinstall all packages now that I've fixed my permissions issues, so I get those HTML files? The code part got installed correctly, so update.packages doesn't work anymore.

like image 327
ILoveCoding Avatar asked Jul 28 '14 16:07

ILoveCoding


2 Answers

install.packages installs a package even if it exists in your library. And of course it will be in the latest version.

like image 103
alko989 Avatar answered Sep 18 '22 19:09

alko989


You could run this script:

lib_loc <- "[library location]"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
install.packages(pkgs = to_install)

If you are using the default library:

to_install <- unname(installed.packages()[, "Package"])
install.packages(pkgs = to_install)
like image 28
xm1 Avatar answered Sep 17 '22 19:09

xm1