Displaying 20 results from an estimated 20000 matches similar to: "infinite recursion when printing former S4 objects"
2010 Jul 12
1
S4 class extends "data.frame", getDataPart sees "list"
R-Devel:
When I get the data part of an S4 class that contains="data.frame", it gives
me a list, even when the "data.frame" is the S4 version:
> d<-data.frame(x=1:3)
> isS4(d)
[1] FALSE # of course
> dS4<-new("data.frame",d)
> isS4(dS4)
[1] TRUE # ok
> class(dS4)
[1] "data.frame"
2017 Sep 22
2
S4 method implementation for S3 class
2017-09-22 19:04 GMT+02:00 Michael Lawrence <lawrence.michael at gene.com>:
> The %*% function is a primitive. As it says in the documentation under
> ?Methods_Details
>
> Methods may be defined for most primitives, and corresponding
> metadata objects will be created to store them. Calls to the
> primitive still go directly to the C code, which will
2012 Oct 04
1
identical() fails to compare isS4(<S4 instance>) to TRUE
> setClass("A", "integer")
> isS4(new("A"))
[1] TRUE
> identical(isS4(new("A")), TRUE)
[1] FALSE
> sessionInfo()
R Under development (unstable) (2012-10-04 r60876)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5]
2006 May 11
2
S4 initialize methods, unexpected recursive callNextMethod
Hi,
Given a simple three class hierarchy: A <-- B <-- C
I want to define an initialize method for each class such that when I
call new("C", x=5), the initialize methods for A and B are used to
incrementally build the object.
When I do what seems obvious to me using callNextMethod, I get an
infinite recursion. An example follows...
setClass("A",
2006 Feb 06
1
match gets confused by S4 objects
If one accidentally calls match(x, obj), where obj is any S4 instance,
the result is NA.
I was expecting an error because, in general, if a match method is not
defined for a particular S4 class, I don't know what a reasonable
default could be. Specifically, here's what I see
setClass("FOO", representation(a="numeric"))
foo <- new("FOO", a=10)
2006 Jan 03
1
S4 default initialization: unwanted NULL
The default initialization for slots of class "factor" and
"data.frame" gives NULL. This seems odd, since those slots can't ever
be set to NULL by the user. I would expect zero-length instances of
factor and data.frame.
Here is an example:
setClass("FOO", representation(a="factor", b="data.frame", c="numeric"))
[1] "FOO"
2008 Sep 15
2
S4 coercion responsibility
Should functions or the user be responsible for coercing an S4 object
argument containing the proper object (and thus should below be
considered a bug in the packages or not)?
The example is with RSQLite but the same thing happens with RMySQL, and
other DBI packages.
> library("RSQLite") Loading required package: DBI
> m <- dbDriver("SQLite")
> con <-
2019 Sep 11
2
'==' operator: inconsistency in data.frame(...) == NULL
Sorry, I can't reproduce the example below even on the same machine.
However, the following example produces the same error as NULL values in
prior examples:
> setClass("FOOCLASS",
+????????? representation("list")
+ )
> ma = new("FOOCLASS", list(M=matrix(rnorm(300), 30,10)))
> isS4(ma)
[1] TRUE
> data.frame(a=1:3) == ma
Error in
2007 Mar 15
4
R 2.5.0 devel try issue in conjuntion with S4 method dispatch
Hi,
after updating R 2.5.0 devel yesterday we today observed many new
unexpected failures in our daily package build and test system runs,
which can be traced to recent changes in the implementation in try()
(as noted in NEWS).
Investigating this new implementation I come across an issue in
conjuntion with using S4 classes and methods. try(expr) does not return an
object with attribute
2007 Jun 04
2
locked environment and inheritance
Hi,
I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create
a S4 class which extends (adds 2 slots) another S4 class from some other package. The class
should be created in "myPkg" environment (and not global environment).
Using:
setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2017 Sep 22
2
S4 method implementation for S3 class
Hi all,
I'm trying to implement the matrix multiplication operator, which is
S4 generic, for an old-style S3 class. The following works as
expected:
x <- 1:10
class(x) <- "myClass"
setOldClass("myClass")
setGeneric("myMethod", function(x, y) standardGeneric("myMethod"))
setMethod("myMethod", c("myClass", "myClass"),
2006 Sep 03
1
Internal flag for S4 objects
A recent revision (svn version 39077) has introduced an internal flag (a
bit in the C structure) that is turned on by the code that generates
objects from an S4 class.
There are corresponding tests for an S4 object, isS4() in R and
IS_S4_OBJECT() in C. These are fast and reliable, and should replace
any heuristic tests previously used.
The tests are not currently used widely, but in the
2007 Apr 26
1
Problem with R-2.5.0 patched and Matrix package
Hi,
Using latest R 2.5.0 Patched, I'm unable to install the Matrix package
from cran.fhcrc.org.
I get:
Creating a new generic function for "isSymmetric" in "Matrix"
Creating a new generic function for "unname" in "Matrix"
Error in conformMethod(signature, mnames, fnames, f) :
In method for function "!": formal arguments omitted in
2006 Apr 12
1
yet another problem with S4 dispatch (with setClassUnion)
Dear John and Seth, dear R-devels,
once again the question of method dispatch in S4 -- this time with
setClassUnion(); taking up your advice in
https://stat.ethz.ch/pipermail/r-devel/2006-April/037200.html
https://stat.ethz.ch/pipermail/r-devel/2006-April/037201.html
I have been too quick in stating that
>setClassUnion()---at least in my case---solves the problem;
>
The problem arises
2006 Apr 07
4
setIs and method dispatch in S4 classes
Dear all,
I have a question regarding setIs and method dispatch in S4 classes:
Consider the following example:
#####################################################
## A02 "contains" A01 by setIs:
setClass("A01", representation(a="numeric",b="numeric"))
setClass("A02", representation(a="numeric",d="numeric"))
2007 May 08
2
Problem calling $ inside a $ method
Hello,
I wonder if this will make it through the spam filters given the
subject line.
I'm seeing the following when trying to call a dollar method inside of
a dollar method.
setClass("Foo", representation(d="list"))
[1] "Foo"
f <- new("Foo", d=list(bob=1, alice=2))
## We can call dollar at this level and it works as expected
2007 May 28
2
S4 object slot of type 'call'
I'm using an S4 object with a slot of type 'call': I would like to be able to initialize
it with something like NULL or NA (indicating that there is no information in the slot)
but the value should comply with the fact that it must be of type call.
Is there any simple way to obtain this?
Thanks for any hint,
Roberto
--
<r/>
| Roberto Brunelli - [scientist at Fondazione
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi Mehmet,
On 11/29/2017 11:22 AM, Suzen, Mehmet wrote:
> Hi Herve,
>
> I think you are confusing subclasses and classes. There is no
> contradiction. `is` documentation
> is very clear:
>
> `With one argument, returns all the super-classes of this object's class.`
Yes that's indeed very clear. So if "list" is a super-class
of "data.frame" (as
2003 Sep 28
1
infinite recursion during package installation with methods, setAs
I ran into a problem recently trying to update a package which uses S4
methods using a recent beta of R. I think I can reproduce it with a
simple example. I have package called `testpkg' in directory testpkg/.
In the R/ subdirectory of testpkg/ I have a file called testpkg.R which
contains the following two lines:
setClass("testpkg", representation(pts = "list"))
2007 Jul 16
1
S4 coerce
(I am not sure if this is a bug or a request for a more understandable
warning, or possible something obvious I should be posting on r-help.)
I am trying to coerce an new class object to be a DBIConnection and it
does not work the way I think it should:
R version 2.5.1 (2007-06-27) ...
> require("RMySQL") # or require("RSQLite")
Loading required package: RMySQL
Loading