[Rd] Repeated library() of one package with different include.only= entries

Michael Chirico m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Mon Apr 8 19:19:29 CEST 2024


Right now, attaching the same package with different include.only= has no
effect:

library(Matrix, include.only="fac2sparse")
library(Matrix)
ls("package:Matrix")
# [1] "fac2sparse"

?library does not cover this case -- what is covered is the _loading_
behavior of repeated calls:

> [library and require] check and update the list of currently attached
packages and do not reload a namespace which is already loaded

But here we're looking at the _attach_ behavior of repeated calls.

I am particularly interested in allowing the exports of a package to be
built up gradually:

library(Matrix, include.only="fac2sparse")
library(Matrix, include.only="isDiagonal") # want: ls("package:Matrix") -->
c("fac2sparse", "isDiagonal")
...

It seems quite hard to accomplish this at the moment. Is the behavior to
ignore new inclusions intentional? Could there be an argument to get
different behavior?

	[[alternative HTML version deleted]]



More information about the R-devel mailing list