search for: isnamespaceloaded

Displaying 10 results from an estimated 10 matches for "isnamespaceloaded".

2022 Jan 21
1
isNamespaceLoaded() while the namespace is loading
We ran into a bug in our package that seems to boil down to isNamespaceLoaded() returning TRUE for namespaces that R is currently loading. We had something like this in an .onLoad function: if (isNamespaceLoaded("upstream")) { upstream::upstream_function() } Which seems OK, unless upstream (recursively) imports the package having this code. Should that happen,...
2015 Jan 26
2
speedbump in library
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Mon, 26 Jan 2015 05:12:55 -0800 writes: > A isNamespaceLoaded() function would be a useful thing to > have in general if we are interested in readable code. An > efficient implementation would be just a bonus. Good point (readability), and thank you for the support! Note one slight drawback with your name (which is clearly better than mine fir...
2017 Feb 27
5
Test suite failures in R-devel_2017-02-25_r72256
...on), the "base" test in "tests/Examples" fails, apparently because it depends on MASS. I'm citing from "base-Ex.Rout.fail": | > ## The string "foo" and the symbol 'foo' can be used interchangably here: | > stopifnot( identical(isNamespaceLoaded( "foo" ), FALSE), | + identical(isNamespaceLoaded(quote(foo)), FALSE), | + identical(isNamespaceLoaded(quote(stats)), statL)) | > | > hasM <- isNamespaceLoaded("MASS") # (to restore if needed) | > Mns <- asNamespace("...
2017 Feb 27
0
Test suite failures in R-devel_2017-02-25_r72256
...; test in > "tests/Examples" fails, apparently because it depends on MASS. I'm > citing from "base-Ex.Rout.fail": > | > ## The string "foo" and the symbol 'foo' can be used interchangably here: > | > stopifnot( identical(isNamespaceLoaded( "foo" ), FALSE), > | + identical(isNamespaceLoaded(quote(foo)), FALSE), > | + identical(isNamespaceLoaded(quote(stats)), statL)) > | > > | > hasM <- isNamespaceLoaded("MASS") # (to restore if needed) > | &gt...
2017 Mar 01
0
Test suite failures in R-devel_2017-02-25_r72256
...; test in > "tests/Examples" fails, apparently because it depends on MASS. I'm > citing from "base-Ex.Rout.fail": > > | > ## The string "foo" and the symbol 'foo' can be used interchangably here: > | > stopifnot( identical(isNamespaceLoaded( "foo" ), FALSE), > | + identical(isNamespaceLoaded(quote(foo)), FALSE), > | + identical(isNamespaceLoaded(quote(stats)), statL)) > | > > | > hasM <- isNamespaceLoaded("MASS") # (to restore if needed) > | > Mns...
2015 Jan 26
0
speedbump in library
...dressing this, Michael On Mon, Jan 26, 2015 at 5:51 AM, Martin Maechler < maechler at lynne.stat.math.ethz.ch> wrote: > >>>>> Michael Lawrence <lawrence.michael at gene.com> > >>>>> on Mon, 26 Jan 2015 05:12:55 -0800 writes: > > > A isNamespaceLoaded() function would be a useful thing to > > have in general if we are interested in readable code. An > > efficient implementation would be just a bonus. > > Good point (readability), and thank you for the support! > > Note one slight drawback with your name (which is...
2015 Jan 26
2
speedbump in library
>>>>> Winston Chang <winstonchang1 at gmail.com> >>>>> on Fri, 23 Jan 2015 10:15:53 -0600 writes: > I think you can simplify a little by replacing this: > pkg %in% loadedNamespaces() > with this: > .getNamespace(pkg) almost: It would be !is.null(.getNamespace(pkg)) > Whereas getNamespace(pkg) will load the
2023 Jan 09
1
Shouldn't "Loading" be "Attaching" when referring to library() calls?
.../library/base/R/library.R#L967-L968 https://github.com/r-devel/r-svn/blob/4198a2941b702d965bb2374c2b908f48c369f40a/src/library/base/R/library.R#L684-L685 Shouldn't "Loading" be "Attaching" instead? My understanding is "a package is loaded" is equivalent to "isNamespaceLoaded()", i.e., loadNamespace() was run. And that "a package is attached" is equivalent to "pkg %in% .packages()", i.e., library(pkg) was run. Is the terminology not so precise? There's certainly ambiguity in the internal variable names referenced above -- in require, we se...
2023 Jan 10
1
Shouldn't "Loading" be "Attaching" when referring to library() calls?
...ch(.) has always worked for data frames (already in pre-R S). Still, I agree (when teaching and otherwise), we should clearly distinguish the two notably in the context of packages and their namespaces. > My understanding is "a package is loaded" is equivalent to > "isNamespaceLoaded()", i.e., loadNamespace() was run. And that "a > package is attached" is equivalent to "pkg %in% .packages()", i.e., > library(pkg) was run. or (easier for teaching) that "package:<pkg>" %in% search() -- which is what .packages() does {by de...
2015 Jan 26
0
speedbump in library
A isNamespaceLoaded() function would be a useful thing to have in general if we are interested in readable code. An efficient implementation would be just a bonus. On Mon, Jan 26, 2015 at 3:36 AM, Martin Maechler <maechler at lynne.stat.math.ethz.ch> wrote: >>>>>> Winston Chang <winstonch...