Brian Lunergan
2024-Sep-23 16:35 UTC
[R] Loading multiple packages with install.packages()...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi folks: Curious question. I've added Rcmdr to my setup (R 4.4.1). I would like to add all of the plugins. Is there a way to get install.packages() to gather up everything starting 'rcmdrplugin', or do I have to list each package individually between the brackets?? ?? Regards... - -- Brian Lunergan Russell, Ontario Canada -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEETYnejayhh3NYXwphdgjwxcHhY5wFAmbxmNIACgkQdgjwxcHh Y5wR9wf7BDbw9feBoJ/F6y3vHCNxuksaDJn263ur9HKFgJYwHLqjD6yRqzvhf9IG N7G4LCmzjUk5NyjmKEGLCUCwGHYCxq6J0kKoWdwXczQzfxLDSBs2ePTcAhmaHmf4 60dZO7na9f6DXOqW2QQzb3A6P+dSUAHdhn1mP9RctjUq9pX1nrq+JUTAke/HsD/N mV6FkQX0HMgZZR3KTkORePy2q+Ejui+Ct1iS0sCpSLsOJ9X4U20GlimdvD8JY00M JWMPUgmu4nk9qebchqiegCydBMEemYT7FboS+B9fzGV7gHHojHYAppoQvPi5yjDy XfR+4SqRzBlLNHxUbhepwEmUAfeIQw==JX0e -----END PGP SIGNATURE-----
Ebert,Timothy Aaron
2024-Sep-23 16:40 UTC
[R] Loading multiple packages with install.packages()...
If you can get a vector with all the package names (I do not know how to do this) then you could do something like this; # Function to check and install missing packages install_if_missing <- function(pkg) { if (!require(pkg, character.only = TRUE)) { install.packages(pkg, dependencies = TRUE) } library(pkg, character.only = TRUE) } # List of required packages. packages <- c("emmeans", "multcomp", "sandwich", "multcompView", "ggplot2", "stringr", "dplyr", "openxlsx", "tidyr") # Check and install each package lapply(packages, install_if_missing) Regards, Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Brian Lunergan Sent: Monday, September 23, 2024 12:35 PM To: r-help at r-project.org Subject: [R] Loading multiple packages with install.packages()... [External Email] -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi folks: Curious question. I've added Rcmdr to my setup (R 4.4.1). I would like to add all of the plugins. Is there a way to get install.packages() to gather up everything starting 'rcmdrplugin', or do I have to list each package individually between the brackets?? ?? Regards... - -- Brian Lunergan Russell, Ontario Canada -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEETYnejayhh3NYXwphdgjwxcHhY5wFAmbxmNIACgkQdgjwxcHh Y5wR9wf7BDbw9feBoJ/F6y3vHCNxuksaDJn263ur9HKFgJYwHLqjD6yRqzvhf9IG N7G4LCmzjUk5NyjmKEGLCUCwGHYCxq6J0kKoWdwXczQzfxLDSBs2ePTcAhmaHmf4 60dZO7na9f6DXOqW2QQzb3A6P+dSUAHdhn1mP9RctjUq9pX1nrq+JUTAke/HsD/N mV6FkQX0HMgZZR3KTkORePy2q+Ejui+Ct1iS0sCpSLsOJ9X4U20GlimdvD8JY00M JWMPUgmu4nk9qebchqiegCydBMEemYT7FboS+B9fzGV7gHHojHYAppoQvPi5yjDy XfR+4SqRzBlLNHxUbhepwEmUAfeIQw==JX0e -----END PGP SIGNATURE----- ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.