Skip to content
Back to formatted view

Raw Message

Message-ID: <0ac268d8-161c-4c4d-b38c-8f296cc271a3@gmail.com>
Date: 2023-10-12T12:46:36Z
From: Duncan Murdoch
Subject: [R-pkg-devel] Question regarding listing base and recommended packages programmatically and efficiently
In-Reply-To: <AS4P195MB1430D1753ED9AB1C34FDDD7DBED3A@AS4P195MB1430.EURP195.PROD.OUTLOOK.COM>

It would be much faster (but slightly less reliable) to use 
list.files(.libPaths()) to get the names of all installed packages, and 
then filter them to the known list of base and recommended packages, 
which changes very rarely.

Duncan Murdoch

On 12/10/2023 8:34 a.m., Tony Wilkes wrote:
> Dear all,
> 
> In my R package that I'm developing, I use `installed.packages(priority = "base")` to programmatically get all core/base R packages (i.e. base, stats, etc.). And similarly, I use installed.packages(priority = "recommended")?` to programmatically get the recommended R packages (i.e. mgcv, lattice, etc.).
> 
> However, CRAN has requested to not use `installed.packages()`, as it is slow. I fully get and agree with that assesment. I used installed.packages()?` anyway because I could not find a better, fool-proof alternative.
> 
> Nonetheless, I was asked to change this code for optimalisation. So I would like to ask: how do I programmatically get all base/core R packages safely and efficiently, but without using `installed.packages()`? And the same question for recommended R packages. I have of course Googled it, and looked at R's documentation (though R's documentation is large, so it's easy to miss something); no solution found. So if any of you has a smart idea: I'm all ears.
> 
> Thank you in advance.
> 
> Kind regards,
> 
> Tony.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel