TMS TMS - 1 year ago 100
R Question

How to update R2jags in R?

I would like to upgrade one R package to the newer version which is already available. I tried


but it does nothing! No output on console, no error, nothing. I used the same syntax as for
but perhaps I'm doing something wrong. I have been looking at
but I was not been able to figure out how it works, where to specify the package(s) etc. There is no example. I also tried to update the package using
to "install" it again but that says "Warning: package ‘R2jags’ is in use and will not be installed".

Answer Source

You can't do this I'm afraid, well, not with update.packages(). You need to call install.packages("R2jags") instead.

You can't install R2jags in the current session because you have already loaded the current version into the session. If you need to, save any objects you can't easily recreate, and quit out of R. Then start a new R session, immediately run install.packages("R2jags"), then once finished, load the package and reload in any previously saved objects. You could try to unload the package with:

detach(package:R2jags, unload = TRUE)

but it is quite complex to do this cleanly unless the package cleans up after itself.

update.packages() exists to update all outdated packages in a stated library location. That library location is given by the first argument (if not supplied it works on all known library locations for the current R session). Hence you were asking it the update the packages in library location R2jags which is most unlikely to exist on your R installation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download