Displaying 20 results from an estimated 8000 matches similar to: "Infinite recursion in getGeneric (PR#4561)"
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2002 May 08
1
Questions about S4 style methods and generics
I have some questions about S4 style methods and generics.
First of all, is there any way of using default values for arguments
in the generics/methods? My own experiments show that such arguments
are always ignored. The green book seems to be silent on this
matter.
The second question is about using a non-trivial function body for
generics. Page 351 of the green book gives an example of this
2004 Jan 29
1
setMethodReplace.. Help!
Hi!
Trying to reproduce some examples from "Programming with Data" page 341.
Can not reproduce it neither on R1.8.1. nor R1.9.0devel?
library(methods)
setClass("track",representation(x="numeric",y="numeric"))
setMethod("["
,"track"
,function(x,...,drop=T){
track(x at x[...],y at y[...])
}
2006 Sep 23
1
generics for primitive functions
i think these two code snippets exhibit a bug. they are identical
but for the inclusion of an initial line in snippet [2]
[1]
setMethod("Math", signature(x = "numeric"), function(x) "Works")
getGeneric("sqrt")(4)
[2]
getGeneric("sqrt")(4)
setMethod("Math", signature(x = "numeric"), function(x) "Works")
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
2015 Jan 29
3
[Q] Get formal arguments of my implemented S4 method
On Jan 28, 2015, at 6:37 PM, Michael Lawrence <lawrence.michael at gene.com> wrote:
> At this point I would just due:
>
> formals(body(method)[[2L]])
>
> At some point we need to figure out what to do with this .local() confusion.
Agreed, definitely. The current hack is to avoid re-matching arguments on method dispatch, so a fix would need to be fairly deep in the
2004 Sep 29
1
Problem with _new_ if class "lm" in object representation.
Hi!
Consider this code.
setClass("Ctest"
,representation(
test="character"
,bla="character"
,mod="lm"
)
)
new("Ctest",test="bla") #This produces an error.
#Error in validObject(.Object) : Invalid "Ctest" object: Invalid object for slot "mod" in class "Ctest": got class
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",
2015 Jan 29
2
[Q] Get formal arguments of my implemented S4 method
I wish it didn't have to depend on the name '.local'.
Back when I wrote a lot of S4 methods I avoided the auto-generated .local
and named the local function something that made sense so that is was easier
for a user to track down the source of an error.
E.g., define the generic QQQ with numeric and integer methods:
setGeneric("QQQ",
function(x, ...)NULL)
2003 Sep 05
2
S4 Method Collisions with "[" (PR#4075)
Full_Name: Colin A. Smith
Version: 1.8.0
OS: Mac OS X 10.2.6
Submission from: (NULL) (216.102.90.18)
Both Biobase and my package annaffy use S4 classes to define methods for "[".
Both packages use the save image method of installation. (See annaffy 1.0.3 in
BioC CVS.)
Depending on how both packages are loaded, the Biobase definitions seem to be
getting masked out:
>
2015 Jan 29
1
[Q] Get formal arguments of my implemented S4 method
Would we really need the special class or would simply checking the formals
of the method against those of the generic be simple and fast enough?
On Thu, Jan 29, 2015 at 9:41 AM, John Chambers <jmc at r-project.org> wrote:
> I wouldn't want to add more to the current approach; if someone would like
> to devote some time, the much preferable idea IMO would be to replace the
>
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
2006 Sep 22
1
Possible bug in base::namespaceImportFrom?
Hi,
namespaceImportFrom in base/R/namespace.R has the following:
fdef <- methods:::getGeneric(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
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
Hello,
Thomas Stabla (statho3@web.de) has already sent this
question to R-help, Wed, 12 Nov 2003 21:21:31 +0100,
but we are not sure whether we should better post this
mail to this audience than to R-help:
---------------------------------------------------------------------
We are using S4-classes and want to force a validity check
when an object is created.
How can this be done, when an
2003 Mar 02
1
'methods' and "[<-"
Dear List,
I am trying to override the replace method "[<-" for
objects of class "matrix"... with little success...
Would anyone know where I am wrong ?
> library(methods)
> setReplaceMethod("[", "matrix", function(x, i, j, ..., value) {cat("I'm here.\n")})
[1] "[<-"
> m <- new("matrix", 0, 5, 2)
>
2003 Oct 09
1
S4 group generic Complex not working (PR#4483)
The Complex group generic for S4 methods is not working:
> setClass('foo', representation(z='complex'))
[1] "foo"
> setMethod('Complex', 'foo', function(z) callGeneric(z@z))
[1] "Complex"
> Arg(new('foo', z=1+0i))
Error in Arg(new("foo", z = 1 + (0+0i))) :
non-numeric argument to function
>
The fix is
2003 May 24
2
Re: R-devel Digest, Vol 3, Issue 23
I am another person who has had trouble documenting S4 classes and
(particularly) methods. The methods package itself is pretty cool by the
way, but it is a pity that there are as yet no guidelines on S4 in the
"Writing R Extensions" document.
I have actually put together a guide on S4 documentation myself for the use
of my own lab which is at
2004 Feb 15
2
build problems on Fedora Core 1
Hello...
I tried to build R-devel today on Fedora Core 1 (with gcc 3.3.2)
but I am running into a couple of errors. On the same system R-1.8.1
compiles just fine, as did a previous version of R-devel.
This is what I did:
# change LANG as default in FC1 is UTF-8
export LANG=en_US.ISO8859-1
export LANGVAR=en_US.ISO8859-1
# get fresh sources and configure
mkdir R-devel
rsync -vrC