Update All R Packages via a Bash Script
Hi !
Since I strongly advocate applying software updates when required, why make an exception for packages from CRAN (https://cran.r-project.org/web/packages/index.html)?
Here’s the method I use (weekly) to do this:
#!/bin/sh
/usr/local/bin/Rscript -e 'update.packages(ask = FALSE, checkBuilt = TRUE, repos="<choose_the_mirror_you_prefer>")'
Speaking of mirrors, here is the official list: https://cran.r-project.org/mirrors.html
Choose the one that best suits your tastes (in my case, geographical proximity).
The reason for updating packages can be summed up in two words: safety and security. Why the last point, because actually, it has already happened that packages distributed via the Comprehensive R Archive Network (CRAN) have experienced security-related problems (although the overall ecosystem is generally considered to be more controlled than repositories such as PyPI or npm).
Conclusion
To make a long story short, keep your packages up to date.
Cheers.