search for: mustfind

Displaying 7 results from an estimated 7 matches for "mustfind".

2006 Sep 22
1
Possible bug in base::namespaceImportFrom?
...neric(genName, impenv) The definition of getGeneric is in methods/R/RMethodUtils.R starts with: getGeneric <- ## return the definition of the function named f as a generic. ## ## If there is no definition, throws an error or returns ## NULL according to the value of mustFind. function(f, mustFind = FALSE, where = .genEnv(f, topenv(parent.frame()), package), package = "") I think the call to getGeneric in namespaceImportFrom should use named arguments because impenv, an environment, will be assigned to the mustFind arg which is most likel...
2015 Jan 21
2
reducing redundant work in methods package
Doing it like this: genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind = TRUE) { ans = .BasicFunsList[[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 %s in this version of R",...
2015 Jan 22
0
reducing redundant work in methods package
...is.null(ans). So no error is thrown: > methods:::genericForPrimitive("foo") NULL Will fix. On Wed, Jan 21, 2015 at 3:13 PM, Peter Haverty <haverty.peter at gene.com> wrote: > Doing it like this: > > genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind > = TRUE) { > > ans = .BasicFunsList[[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 %s > i...
2015 Jan 21
2
reducing redundant work in methods package
Hi all, The function call series genericForPrimitive -> .findBasicFuns -> .findAll happens 4400 times while the GenomicRanges package is loading. Each time .findAll follows a chain of environments to determine that the methods namespace is the only one that holds a variable called .BasicFunsList. This accounts for ~10% of package loading time. I'm sure there is some history to that
2010 Oct 18
0
wishlist: system.file(..., mustExist = TRUE)
...ntical(theFile, "")) scan(what="", sep="\n", theFile) else stop("Cannot find file \"DESCRIPTION\" in package \"base\"") but that would be pretty ugly in a help file. What do you think of adding an argument mustExist=FALSE or mustFind=FALSE to system.file() such that if it is TRUE and no file is found then system.file throws an error? Then my example could be scan(what="", sep="\n", system.file("DESCRIPTION", mustExist=TRUE)) and it would throw an informative error message instead of returning &...
2012 Apr 05
1
issue with base:::namespaceImportMethods
...(get(g, envir = ns), "genericFunction")) { allVars <- c(allVars, g) + generics <- c(generics, g) + packages <- c(packages, p) + } 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,...
2015 May 28
3
S4 inheritance and old class
Hey everyone, I would like to develop a package using S4 classes. I have to define several S4 classes that inherits from each others as follow: # A <- B <- C <- D I also would like to define .DollarNames methods for these class so, if I have understood well, I also have to define an old class as follow: # AOld <- A <- B <- C <- D setOldClass(Classes = "AOld")