search for: basicfunslist

Displaying 13 results from an estimated 13 matches for "basicfunslist".

2007 Jan 25
1
"rep" missing from methods:::.BasicFunsList
With: R version 2.4.1 Patched (2007-01-22 r40548) "rep" is missing from methods:::.BasicFunsList, causing methods:::genericForPrimitive("rep") to fail, which in turn causes setMethod("rep", ...) to fail. (setGeneric("rep") of course fails as it should, saying that rep is a primitive and methods can be set). Here's the fix: build_main at mambo:/vobs/produc...
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", sQuote(f)), domain...
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 design, but would it be possible shortcut this operation? Could .BasicFunsList be initialized in the methods namespace at startup and might genericForPrimitive just go straight there? Does anyone on the lis...
2015 Jan 22
0
reducing redundant work in methods package
...thods:::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 > in this version of R", > >...
2015 Jan 21
0
reducing redundant work in methods package
Note that setMethod() resolves .BasicFunsList in the methods namespace directly when setting a method on a primitive. Somehow there should be consistency between genericForPrimitive() and the check in setMethod(). Also, we can probably step away from the use of elNamed(), given that [[ now uses exact matching. Have you tried patching methods...
2011 Jun 29
0
Error in testInstalledBasic
...39;~') > > known <- c(ls(.GenericArgsEnv, all.names=TRUE), + ls(.ArgsEnv, all.names=TRUE), + lang_elements) > stopifnot(ff %in% known, known %in% ff) > > > ## check which are not considered as possibles for S4 generic > ff4 <- names(methods:::.BasicFunsList) > # as.double and as.real are the same as as.numeric > S4generic <- ff %in% c(ff4, "as.double", "as.real") > notS4 <- ff[!S4generic] > if(length(notS4)) + cat("primitives not covered in methods:::.BasicFunsList:", + paste(sQuote(notS4), c...
2005 Jan 13
3
as.character methods
Hello, ?as.character says that the as.character function is a generic with usage: as.character(x, ...). So, I want to create an S4 object with an as.character method following the above usage, but I get the below error telling me that ... isn't in the generic for as.character. > setClass("tmp", "numeric") > setMethod("as.character", "tmp",
2005 Jan 13
3
as.character methods
Hello, ?as.character says that the as.character function is a generic with usage: as.character(x, ...). So, I want to create an S4 object with an as.character method following the above usage, but I get the below error telling me that ... isn't in the generic for as.character. > setClass("tmp", "numeric") > setMethod("as.character", "tmp",
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
...eply ## to mail: "Missing 'getGroupMembers()'" ## from Sat May 31 2003 - 15:18:18 EDT) ## Modification of this code ## since 'genericForPrimitive' is not defined (?) ## although it is called in 'getGeneric'!!! getGroups <- function(what = c(getGenerics(), names(.BasicFunsList))) { what <- what[what != "is.function"] what <- what[what != "is.null"] what <- what[what != "is.object"] g <-unlist(sapply(what, function(x){ f <- getGeneric(x) if(is(f, "genericFunction&qu...
2016 Sep 25
1
Undocumented 'use.names' argument to c()
...was preferable to the current state, I'd tend to the first one: Consider 'use.names [= FALSE]' just an argument of the default method for c(), so existing c() methods would not have a strong need for updating. Notably, as the S4 generic for c, via lines 48-49 of src/library/methods/R/BasicFunsList.R , "c" = structure(function(x, ..., recursive = FALSE) standardGeneric("c"), signature="x") has never had 'recursive' as part of the signature.. (and yes, that line 48 does need an update too !!!). Martin >>>> -----------...
2003 May 30
3
Missing 'getGroupMembers()'
Hi, I'm trying to write a method such that my own classes can be used with the groups like "Summary" and "Math", but when I tried to look for examples or just wanted to get an idea of which functions are the members of a group, I found out that the function "getGroupMembers" is not present... I couldn't find an alternative function, if there is one. Does
2016 Sep 23
2
Undocumented 'use.names' argument to c()
I'd vote for it to stay. It could of course suprise someone who'd expect c(list(a=1), b=2, use.names = FALSE) to generate list(a=1, b=2, use.names=FALSE). On the upside, is the performance gain from using use.names=FALSE. Below benchmarks show that the combining of the names attributes themselves takes ~20-25 times longer than the combining of the integers themselves. Also, at no
2011 Jun 30
0
help with interpreting what nnet() output gives:
...39;~') > > known <- c(ls(.GenericArgsEnv, all.names=TRUE), + ls(.ArgsEnv, all.names=TRUE), + lang_elements) > stopifnot(ff %in% known, known %in% ff) > > > ## check which are not considered as possibles for S4 generic > ff4 <- names(methods:::.BasicFunsList) > # as.double and as.real are the same as as.numeric > S4generic <- ff %in% c(ff4, "as.double", "as.real") > notS4 <- ff[!S4generic] > if(length(notS4)) + cat("primitives not covered in methods:::.BasicFunsList:", + paste(sQuote(notS4), c...