search for: asnamespace

Displaying 20 results from an estimated 87 matches for "asnamespace".

2009 Sep 11
1
Modify functions in base packages (needed for completion for proto objects)
...s defining names.class would do the job, but completion for "environment" is hard coded in utils:::specialCompletions by means of base::ls(). As result defining names.proto does not work. I tried to make "ls" generic and to do something like: environment(ls.default) <- asNamespace('utils') environment(ls) <- asNamespace('utils') environment(ls.proto) <- asNamespace('utils') That does not work either. Is there a way to make utils:::specialCompletions use my "ls" instead of "base::ls"?? I know Deepayan Sarkar is working no...
2008 Jun 14
1
How to see data for a package built under Windows
...preparing package DiagMeta for lazy loading Loading required package: lme4 Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs Warning in namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: cov2cor Warning in namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: update Warning in namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: xtabs installing man source files installing indices not zipping data...
2011 Jun 23
1
Class not found when search in .onLoad
...At the loading check after installation, the classes are not found by `isClass` and `extends` when these are called in .onLoad, but are correctly found when called in .onAttach. However findClass correctly finds the class in both case, as well as isClass if it is called with the argument `where=asNamespace('<THE.PACKAGE.NAME>')`. When the package is loaded from an open R session, the behaviour is the same. in R 2.12.1: the classes are correctly found by isClass and extends when these are called in .onLoad or .onAttach, but only at installation (i.e. at the loading check after R CMD...
2011 May 31
1
assignInNamespace and new bindings
...that is not already used in the namespace. Something like this would make it possible: --- src/library/utils/R/objects.R (revision 56024) +++ src/library/utils/R/objects.R (working copy) @@ -252,8 +252,9 @@ stop("environment specified is not a package") ns <- asNamespace(substring(nm, 9L)) } else ns <- asNamespace(ns) - if(bindingIsLocked(x, ns)) { - unlockBinding(x, ns) + new_binding <- !exists(x,ns) + if( new_binding || bindingIsLocked(x, ns)) { + if(!new_binding) unlockBinding(x, ns) assign(x, value, envir = ns, inher...
2015 Jan 08
4
unloadNamespace
In the documentation the closed thing I see to an explanation of this is that ?detach says "Unloading some namespaces has undesirable side effects" Can anyone explain why unloading tseries will load zoo? I don't think this behavior is specific to tseries, it's just an example. I realize one would not usually unload something that is not loaded, but I would expect it to do
2008 Apr 28
0
method dispatch conflict?
...kage: Matrix Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs Attaching package: 'lme4' The following object(s) are masked from package:stats4 : BIC Warning messages: 1: In namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: cov2cor 2: In namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: update 3: In namespaceImportFrom(self, asNamespace(ns)) : replacing previous import: xtabs R> example example R> example(lmer) lmerR> (fm1 <- lmer(Reaction ~ Da...
2015 Jan 26
2
speedbump in library
...clearly better than mine first proposal): We'd have the three functions named isBaseNamespace(ns) isNamespace(ns) isNamespaceLoaded(name) where 'name' is really different from 'ns', namely : > isNamespace("stats") [1] FALSE > isNamespace(asNamespace("stats")) [1] TRUE but > isNamespaceLoaded("stats") [1] TRUE > isNamespaceLoaded(asNamespace("stats")) Error in as.vector(x, "symbol") : cannot coerce type 'environment' to vector of type 'symbol' > So, from my (...
2008 Feb 17
1
NAMESPACEs and S4 classes
I'd like to have two packages with S4 classes with the same name but different implementation. To that end I create a package tmpA with setClass("A", representation=representation( x="numeric"), sealed=TRUE) setClass("B", representation=representation( x="numeric")) B <- function(...)
2015 Jan 21
2
reducing redundant work in methods package
...SE)) stop(gettextf("methods may not be defined for primitive function %s in this version of R", sQuote(f)), domain = NA) ans } or this: genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind = TRUE) { env = asNamespace("methods") funs <- env[[".BasicFunsList"]] ans = funs[[f]] ## this element may not exist (yet, during loading), dom't test null if(mustFind && identical(ans, FALSE)) stop(gettextf("methods may not be defined for primitive function...
2010 Oct 11
2
Trouble accessing cov function from stats library
...ing this function from the console. However, in my R script I received a "function not found" message. Then I called stats::cov(...) and received an error message that the function was not exported. Then I tried stats:::cov (three colons) and received the error Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'Cov' not found I am also importing the ltm library, though I'm not aware of a cov function in ltm that could be causing a conflict. Any suggestions? Thanks Barth ________________________________ PRIVILEGED AND CONFIDENTIAL INFORMATION This transmi...
2017 Feb 27
5
Test suite failures in R-devel_2017-02-25_r72256
...(isNamespaceLoaded( "foo" ), FALSE), | + identical(isNamespaceLoaded(quote(foo)), FALSE), | + identical(isNamespaceLoaded(quote(stats)), statL)) | > | > hasM <- isNamespaceLoaded("MASS") # (to restore if needed) | > Mns <- asNamespace("MASS") # loads it if not already | Error in loadNamespace(name) : there is no package called 'MASS' | Calls: asNamespace ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> | Execution halted I hope this helps! Best regards, Peter [1] http://ni...
2012 Oct 22
4
¿Problemas al cargar slqdf sobre Windows....?
Hola, Estoy intentando cargar la librería "sqldf" y obtengo este error: > library(sqldf) Loading required package: gsubfn Error : .onLoad failed in loadNamespace() for ''gsubfn'', details: call: get(name, envir = asNamespace(pkg), inherits = FALSE) error: objeto ''addVigs2WinMenu'' no encontrado Error: package ‘gsubfn’ could not be loaded La versión que tengo de sqldf es esta: Package: sqldf Version: 0.4-6.4 Date: 2012-03-20 Y la de gsubfn: Package: gsubfn Version: 0.6-4 Date: 2012-08-01 Sobre Win...
2016 May 20
2
identical on closures
I'm confused by this: > identical(function() {}, function() {}) [1] FALSE Yet, after loading the Matrix package (which redefines det), the following is checked (in library.checkConflicts): > identical(get("det", baseenv()), get("det", asNamespace("Matrix")), ignore.environment=T) [1] TRUE I've looked at the code in identical.c and for closures it seems to compare the FORMALS and the BODY_EXPR, so why does the first example not return TRUE as surely the formals and body are identical? case CLOSXP: return(R_comput...
2012 Apr 05
1
issue with base:::namespaceImportMethods
...else { # should be primitive fun <- methods::getFunction(g, mustFind = FALSE, where = self) if(is.primitive(fun) || methods::is(fun, "genericFunction")) {} @@ -970,7 +979,7 @@ } } } - namespaceImportFrom(self, asNamespace(ns), allVars, allFuns, packages) + namespaceImportFrom(self, asNamespace(ns), allVars, generics, packages) } ----------------------------- Thanks for any advice, Michael PS: sessionInfo() (yes, ggbio has a LOT of dependencies): > sessionInfo() R Under development (unstable) (2012-04-04...
2015 Jan 21
2
reducing redundant work in methods package
...count calls to a function .count <- 0; trace(methods:::.findBasicFuns,tracer=function() { .count <<- .count + 1 }); library(GenomicRanges); print(.count) # Try this to capture the input and output of a set of functions you wish to refactor .init_test_data_collection <- function(ns = asNamespace("methods")) { funs = c("isClassUnion", "getClass", "genericForPrimitive", "possibleExtends", ".dataSlot", ".requirePackage", ".classEnv", "getClassDef", "outerLabels", ".getClassFromCache&q...
2015 Jan 09
0
unloadNamespace
It's probably because the first thing that unloadNamespace does is this: ns <- asNamespace(ns, base.OK = FALSE) If you call asNamespace("tseries"), it calls getNamespace("tseries"), which has the side effect of loading that package (and its dependencies). One way to work around this is to check loadedNamespaces() before you try to unload a package. -Winston On Thu...
2009 Nov 13
2
How to show all the functions and classes that are defined in a library?
library(some_library_name) Suppose I load a library. I'm wondering what command I should use to list all the functions, classes and variables defined in the library.
2010 Aug 05
1
Sciviews-K -- object 'httpdPort' not found
Hi, I'm trying to install Sciviews-K on Linux Ubuntu 9.10 (karmic) but I'm not able to establish the connection between Komodo and R. Here;s the error I get, plus some diagnostic info: R version 2.9.2 (2009-08-24) R is SciViews ready! Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :   object 'httpdPort' not found > ls() [1] "svStart" > Sys.info()                                       sysname                                       "Linux"                                       release                           &quot...
2007 May 15
1
getNamespaceExports("base") error
Hi! >getNamespaceExports("base") Error in ls(NULL, all = TRUE) : using 'as.environment(NULL)' is defunct getNamespaceExports function (ns) { ns <- asNamespace(ns) if (isBaseNamespace(ns)) ls(NULL, all = TRUE) else ls(getNamespaceInfo(ns, "exports"), all = TRUE) } <environment: namespace:base> One possible way to fix this could be to changed to e.g. if (isBaseNamespace(ns)) ls(envir=baseenv(), all = TRUE) Observed...
2014 Nov 15
1
Code tools for identifying which package A functions package B use?
Hi, I'd like to list all package PkgA functions that another package PkgB use via Depends or Imports (ignoring Suggests for simplicity). As long as PkgB uses importFrom("PkgA", ...) it's just a matter of parsing the NAMESPACE file or inspecting asNamespace("PkgB")$.__NAMESPACE__.$imports. However, what can be done in case PkgB uses import("PkgA")? Is there a function/package already available for this? Thanks, Henrik