I have looked at the help for update.packages(..., checkBuilt = TRUE)
and I am unclear on why one would not want to have TRUE
as the default. The default is FALSE
.
This question has two parts. (1) Can someone give a clear explanation of the use of this argument and rationale for either FALSE
or TRUE
?
As I understand it, if one updates R, then this could have different outcomes - if the packages haven't been updated, then FALSE
will not cause the local libraries to be modified with updated packages, while TRUE
will cause more (all?) packages to be updated. The default option (FALSE
) may confer a speed benefit - fewer packages will be updated. Stability is uncertain - a new version of R may work better with a new package, or it may not (e.g. if there are regressions / bugs in the new package), and it may or may not work with the earlier version of the package (backward compatibility is not guaranteed). Other pros and cons are not obvious to me. (And I may be quite mistaken here - which is why I ask for a clarification as part 1.)
(2) However, if one has not changed the installed version of R, then shouldn't these have the same outcome? See this post for an example where it seems that just calling update.packages()
created problems, even though the version of R did not change.
The key thing to be aware of is that when you update R, if you just download the latest version from the website, you will lose all your packages.
RStudio Package Manager can automatically update packages from CRAN on an admin-defined schedule. Local packages can be updated at any time by adding the tar file for the new version of the package. Packages from Git or GitHub will be updated automatically. Updates can track new commits or new tags.
If you only want to update a single package, the best way to do it is using install. packages() again. In RStudio, you can also manage packages using Tools -> Install Packages.
packages indicates packages which have a (suitable) later version on the repositories whereas update. packages offers to download and install such packages. new. packages looks for (suitable) packages on the repositories that are not already installed, and optionally offers them for installation.
CheckBuilt = TRUE
is especially useful for major upgrades such as 2.14.0 which brought big changes in the namespaces. Packages without a namespace built with previous version of R must be recompiled, otherwise they won't load at all. So if you have such a package (such as ICE) installed in R 2.13, and you update to R 2.14, you won't be able to load it anymore:
> library(ICE)
Error in library(ICE) :
package ‘ICE’ does not have a NAMESPACE and should be re-installed
As there is no newer version with a namespace, update.packages() won't upgrade it without CheckBuilt = TRUE
. So by saying update.packages(checkBuilt = TRUE)
, you clearly say, upgrade all the packages if either:
It won't modify packages that were compiled in the same version of R and without upgrade available on the CRAN. CheckBuilt really means "re-install if compiled in an older version", not "re-install all packages".
Why is it FALSE by default? I guess it puts an huge load on the CRAN and most of the time it is not necessary: I have never seen a problem after a minor upgrade (i.e R 2.13.0 to 2.13.1). I would definitely recommend doing it after any major upgrade such as 2.13.1 to 2.14.0.
I believe the specific case you mention in (2) is an exception. It involves upgrading packages installed with apt rather than from R. You can't really draw any conclusion of such a segfault bug. And anyway, if CheckBuilt = TRUE
upgraded it, it means it was built in a previous version of R.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With