search for: requirenamespace

Displaying 20 results from an estimated 64 matches for "requirenamespace".

2014 Sep 12
1
requireNamespace() questions
I am trying to follow directions at http://cran.r-project.org/doc/manuals/r-patched/R-exts.html#Suggested-packages regarding handling suggested packages with requireNamespace() rather than require(), and I have some questions. 1/ When I do requireNamespace() in a function is the loading of the namespace only effective within the function? 2/ At the link above in the manual it says "Note the use of rgl:: as that object would not necessarily be visible..."....
2014 Sep 28
1
Using requireNamespace() instead of require()
...are rare though, so I put package pkgB under 'Suggests', and use this in funcA() when those circumstances do arise: if (require("pkgB", quietly=TRUE)) { pkgB::funcB(...) } else { stop("Please install package 'pkgB' to do this.") } I understand that using requireNamespace() would be preferable and I would also prefer to do that. But funcB() depends on funcC() from pkgC that it lists under 'Depends'. So, with require("pkgB"), both namespaces (of pkgB and pkgC) are loaded and attached to the search list and things run. But with requireNamespace(&quot...
2015 Feb 20
1
requireNamespace etiquette
...ormula that typically contains something like this: Surv(y, ...) ~ foo, where Surv is a function from the survival package which quantreg suggests. When this syntax is encountered in ordinary usage Surv is resolved, I believe, because near the beginning of the crq code there is the locution: if(!requireNamespace("survival", quietly = TRUE)) stop("crq requires survival package to be installed") However, when R CMD check tries to do one of the crq examples I see: > f <- crq(Surv(y,d,type = "left") ~ x, method = "Portnoy") Error in eval(expr, envir, encl...
2014 Sep 18
1
Can't Find Function After requireNamespace
I have a simple function : f <- function() { if(requireNamespace("ggplot2")) qplot(Sepal.Length, Petal.Length, data = iris, color = Species) else message("No graphics, just text.") } ggplot2 is in the Suggests field of the DESCRIPTION file. When I load the package, and run the function, I get an error : > f() Loading required n...
2015 Feb 24
3
alternatives to do.call() when namespace is attached but not loaded?
...group of functions in another Suggested package (it sets appropriate defaults for the context, transforms output, etc). I've implemented this by verifying that the package was loaded with require(sna) and then do.call(snaFunName, args = args) The rDevel check is requesting that I use requireNamespace(sna) instead of directly loading the SNA package. This seems reasonable, except that I have yet to figure out a way to use do.call to call the function when the namespace is attached but package is not loaded. do.call("sna::funName",..) doesn't seem to work. 1) Can do.call() call...
2020 Oct 11
3
Installing bioconduction packages in connection with loading an R package
...fore). Thanks in advance. Best regards S?ren .onAttach<-function(libname, pkgname) { ## package startup check toinstall=c( "graph", "Rgraphviz", "RBGL" ) already_installed <- sapply(toinstall, function(pkg) requireNamespace(pkg, quietly=TRUE)) if (any(!already_installed)){ packageStartupMessage("Need to install the following package(s): ", toString(toinstall[!already_installed]), "\n") } ## install if needed if(!base::all(already_installed)){...
2019 Jul 23
2
quiet namespace load is noisy
Dear R-devel, Consider the following clip (in R version 3.6.0, Windows): > requireNamespace("ggplot2", quietly = TRUE) Registered S3 methods overwritten by 'ggplot2': method from [.quosures rlang c.quosures rlang print.quosures rlang It seems to me that if one specifies 'quietly = TRUE', then messages about S3 method...
2019 Jul 23
2
[External] Re: quiet namespace load is noisy
...t;> > >>> On 23 Jul 2019, at 06:29, Lenth, Russell V <russell-lenth at uiowa.edu> > wrote: > >>> > >>> Dear R-devel, > >>> > >>> Consider the following clip (in R version 3.6.0, Windows): > >>> > >>>> requireNamespace("ggplot2", quietly = TRUE) > >>> Registered S3 methods overwritten by 'ggplot2': > >>> method from > >>> [.quosures rlang > >>> c.quosures rlang > >>> print.quosures rlang > >>&g...
2019 Jul 23
2
[External] Re: quiet namespace load is noisy
...should be suppressed as well. > > Best, > Lionel > > >> On 23 Jul 2019, at 06:29, Lenth, Russell V <russell-lenth at uiowa.edu> wrote: >> >> Dear R-devel, >> >> Consider the following clip (in R version 3.6.0, Windows): >> >>> requireNamespace("ggplot2", quietly = TRUE) >> Registered S3 methods overwritten by 'ggplot2': >> method from >> [.quosures rlang >> c.quosures rlang >> print.quosures rlang >> >> It seems to me that if one specifies ...
2015 Mar 25
2
vignette checking woes
Thierry, I have this: if (require(MatrixModels) && require(Matrix)) { X <- model.Matrix(Terms, m, contrasts, sparse = TRUE) in my function rqss() I've tried variants of requireNamespace too without success. If I understand properly model.Matrix is from MatrixModels but it calls sparse.model.matrix which is part of Matrix, and it is the latter function that I'm not finding. Maybe I should go back to the requireNamespace strategy again? Roger url: www.econ.uiuc.edu/~roger...
2019 Nov 09
2
improving the performance of install.packages
On 08/11/2019 6:17 p.m., Henrik Bengtsson wrote: > I believe introducing a backward compatible force=TRUE is a good > start, even if we're not ready for making force=FALSE the default at > this point. It would help simplify quite-common instructions like > > if (requireNamespace("BiocManager")) > install.packages("BiocManager") > BiocManager::install(...) > > to > > install.packages("BiocManager", force=FALSE) > BiocManager::install(...) If simplifying instructions is the goal, it would be even simpler to just insta...
2016 May 06
2
Is it possible to increase MAX_NUM_DLLS in future R releases?
...packages as the user switch from one module to another. This brought me another question: it seems that unload package with the detach/unloadNamespace function does not unload the DLLs, or in the case of the "SCDE" package, not all dependent DLLs: > length(getLoadedDLLs()) [1] 9 > requireNamespace("scde") Loading required namespace: scde > length(getLoadedDLLs()) [1] 34 > unloadNamespace("scde") now dyn.unload("/Library/Frameworks/R.framework/Versions/3.3/Resources/library/scde/libs/scde.so") ... > length(getLoadedDLLs()) [1] 33 Does that mean I should...
2019 Nov 08
4
improving the performance of install.packages
Hi Gabe, Keeping track of where a package was installed from would be a nice feature. However it wouldn't be as reliable as comparing hashes to decide whether a package needs re-installation or not. H. On 11/8/19 12:37, Gabriel Becker wrote: > Hi Josh, > > There are a few issues I can think of with this. The primary one is that > CRAN(/Bioconductor) is not the only place one
2016 Apr 04
1
Suggested dependencies in context of R CMD check
...> > That way batch checking packages would be easier, as required dep > > metadata would be at hand in description file. Batch checking pkgs > > with all their suggests will simply result into testing whole CRAN. > > > > In a single package it can be handled with `if (requireNamespace(.)) > > test_package(.)` for `testthat` and `knitr`, also with mocking up > > `.Rout` files. > > > > But I'm interested into canonical design of a suggested package and > > `_R_CHECK_FORCE_SUGGESTS_` env var. > > Is there any R core dev team recommendation/su...
2016 May 04
2
Is it possible to increase MAX_NUM_DLLS in future R releases?
...ncies, so I agree that this at least may happen > accidentally more frequently than in the past. I am not convinced that it is needed. The OP says he imports many packages, and I doubt that more than a few are required at any one time. Good practice is to load namespaces as required, using requireNamespace. > The real solution of course would be a code improvement that > starts with a relatively small number of "DLLinfo" structures > (say 32), and then allocates more batches (of size say 32) if > needed. The problem of course is that such code will rarely be exercised, and pe...
2019 Sep 25
2
depending on orphaned packages?
...s is orphaned on CRAN (and has been since 2013). https://cran.r-project.org/web/checks/check_results_.html Oddly, the simulate method for the inverse.gaussian family [inverse.gaussian()$simulate] depends (in a loose sense) on SuppDists (it fails if the SuppDists namespace is not available: if (!requireNamespace("SuppDists", quietly = TRUE)) stop("need CRAN package 'SuppDists' for simulation from the 'inverse.gaussian' family") The statmod package also implements inverse gaussian d/p/q/r functions <https://journal.r-project.org/archive/2016-1/giner-smyth.p...
2019 Nov 08
0
improving the performance of install.packages
I believe introducing a backward compatible force=TRUE is a good start, even if we're not ready for making force=FALSE the default at this point. It would help simplify quite-common instructions like: if (requireNamespace("BiocManager")) install.packages("BiocManager") BiocManager::install(...) to install.packages("BiocManager", force=FALSE) BiocManager::install(...) and more so when installing lots of packages conditionally, e.g. if (requireNamespace("foo")) install.pac...
2016 May 10
0
Is it possible to increase MAX_NUM_DLLS in future R releases?
...ne module to another. > This brought me another question: it seems that unload package with the detach/unloadNamespace function does not unload the DLLs, or in the case of the "SCDE" package, not all dependent DLLs: >> length(getLoadedDLLs()) > [1] 9 >> requireNamespace("scde") > Loading required namespace: scde >> length(getLoadedDLLs()) > [1] 34 >> unloadNamespace("scde") > now dyn.unload("/Library/Frameworks/R.framework/Versions/3.3/Resources/library/scde/libs/scde.so") ... >> leng...
2019 Nov 09
0
improving the performance of install.packages
.../2019 6:17 p.m., Henrik Bengtsson wrote: > > I believe introducing a backward compatible force=TRUE is a good > > start, even if we're not ready for making force=FALSE the default at > > this point. It would help simplify quite-common instructions like > > > > if (requireNamespace("BiocManager")) > > install.packages("BiocManager") > > BiocManager::install(...) > > > > to > > > > install.packages("BiocManager", force=FALSE) > > BiocManager::install(...) > > If simplifying instructions is the goa...
2015 Apr 29
2
Formula evaluation, environments and attached packages
Hi! Some time ago, I replaced calls to library() with calls to requireNamespace() in my package logmult, in order to follow the new CRAN policies. But I just noticed it broke jackknife/bootstrap using several workers via package parallel. The reason is that I'm running model replicates on the workers, and the formula includes non-standard terms like Mult() which are provi...