similar to: coerce methods and inheritance

Displaying 20 results from an estimated 10000 matches similar to: "coerce methods and inheritance"

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
2005 Feb 10
1
Undocumented S4 methods: generic coerce and siglist matrix, Massvector
Hi, While checking the package I am getting all the time the following complain about the function: Undocumented S4 methods: generic coerce and siglist matrix,Massvector I have not defined the function nowhere in the R files. My gues is that this has something to do with the following definition of the setAs function. setAs("matrix","Massvector" ,def=
2004 Nov 26
1
Namespaces, coercion and setAs
I'm trying to resolve a small problem that has arisen from introducing a NAMESPACE for the package SparseM. Prior to the namespace I had a class "matrix.diag.csr" that consisted of diagonal sparse matrices. It was defined to have the same attributes as the matrix.csr class and setAs was used to define how to coerce integers and vectors into this form:
2009 Aug 17
2
S4: inheritance of validity methods?
Dear Developers, In current implementation of validity method, objects are first coerced to superclass (slots are striped). Thus, it is not possible to write validity method which would perform some checks on children slots. Say, I want to check if number of slots in a class is equal to "n": setClass("A", representation(a="numeric", n="integer"),
2009 Aug 05
1
S4 method dispatch: coercion of arguments with setAs defined
Hi list, I've got a class B that contains a slot obj of class A. I'd like to be able to call all the methods of class A directly on objects of class B as if I had called the method on slot obj. This without overloading all methods of class A to work on class B. I don't define B as an extension of A, because I want class B to also work with objects of classes that inherit from
2003 Aug 24
2
setClass question
I would like to add a class to the SparseM package. I have a class "matrix.csr" that describes a matrix in compressed sparse row format, now I would like a class matrix.diag.csr that describes such objects when they happen to be diagonal. The idea is that matrix.diag.csr objects should behave (later in life) exactly like matrix.csr objects, the distinction is only needed in order to
2004 Oct 25
1
usage and behavior of 'setIs'
Hello, am I using 'setIs' in the correct way in the subsequent (artifical) example? Do I have to specify explicit 'setAs' for 'list' and 'vector' or should this work automatically, since "getClass("List1")" states an explicit coerce also for these classes. I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. Thanks for your
2008 Mar 17
1
setAs vs setIs
Hi the list I am fighting with the twins setAs and setIs... Here are some questions and comments (comments to myself but that migth be wrong, it is why I am posting them) 1. Very surprising : using setIs define 'is', 'as<-' but not 'as' ??? 2. Using setAs define 'as', 'as<-' but not 'is'... What surprise me is that as<- can be define by
2004 Sep 07
2
package methods different behaviour R1.9.1 patched and R2.0.0
Hi! Concerning different behaviour between 1.9.1 patched and: R : Copyright 2004, The R Foundation for Statistical Computing Version 2.0.0 Under development (unstable) (2004-09-06), ISBN 3-900051-07-0 Subtitle: as(x,"vector"); x is of class "Massvector"; never enters setAs("Massvector","vector"... The same code: as(mvl[[1]],"vector") causes
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds? > setClass('foo') [1] "foo" > setAs('foo', 'character', function(from) from) > showMethods('coerce') Function "coerce": from = "ANY", to = "array" from = "ANY", to = "call" from = "ANY", to = "character" from =
2006 Apr 09
2
type converters not being saved to workspace
Any one can explain why this happens or any work arounds? > setClass('foo') [1] "foo" > setAs('foo', 'character', function(from) from) > showMethods('coerce') Function "coerce": from = "ANY", to = "array" from = "ANY", to = "call" from = "ANY", to = "character" from =
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
Dear colleagues, there is a behaviour with S4 (virtual) classes that I find very hard to understand: Depending on the position of setAs(), the tree of inheritance changes. This is my baseline example that defines the classes "grandma", "mother", "daughter" and a virtual class "mr_x". For a new instance if "daughter", "mr_x" is betweeen
2012 Oct 01
1
False positive note about ambiguous dispatch
Hi, In the situation below the note issued by the dispatch algo doesn't seem right: setClass("A", representation(stuff="complex")) setAs("ANY", "A", function(from) new("A", stuff=as.complex(from))) > as(6, "A") An object of class "A" Slot "stuff": [1] 6+0i > as(6L, "A")
2008 Apr 23
1
S4 default for coercing
Something has changed in the S4 default for coercing. Am I now suppose to use setAs, or is there something else I should do to make this work: R version 2.7.0 (2008-04-22) .... > require("methods") > setClassUnion("OptionalPOSIXct", c("POSIXct", "NULL")) [1] "OptionalPOSIXct" > setClass("TSmetax",
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")
2008 Aug 27
1
S4 coercion
I am extending a DBI connection by setClass("TSPostgreSQLConnection", contains=c("PostgreSQLConnection","TSdbOptions")) but the first time I use this I am getting a warning when it tries to coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the first use the warning stops, but the first warning is causing me problems when I do automatic checks
2004 May 13
0
using trace() on S4 coerce method
I'm trying to use trace() on an S4 coerce method, but get the error Error in bindingIsLocked(what, whereM) : no binding for "coerce" What am I doing wrong? Example code follows. (I've googled the R mailing lists for "trace coerce" and "trace bindingisLocked" without finding anything relevant. Perhaps I should re-define the method in terms of an
2008 Apr 15
1
Pb with validObject(..., complete=TRUE)
Hi, When called with complete=TRUE, validObject() is supposed to work in a recursive manner. But here is a situation where it doesn't seem to be the case. Let's define a class with a validity method: setClass("PosInts", representation(ii="integer")) setValidity("PosInts", function(object) { if (!all(object at ii > 0))
2006 Mar 06
1
validObject does not check validity of slots
The documentation for validObject suggests that slots are checked for validity, but validObject seems only to check that the slot has something claiming to be correct; validObject(obj) does not perform the equivalent of validObject(obj at y) for slot y. This is also the second problem issue reported in http://tolstoy.newcastle.edu.au/R/devel/05/03/0151.html Relevant documentation, an example,
2007 Apr 15
0
as() creates invalid entries in methods list?
Hi, We've observed rather strange behavior related to as(). When as() is used to make a conversion to a super class, an invalid entry is inserted into the table of methods. > setClass("A", contains="list") > get(".MTable", environment(coerce))[["list#A"]] NULL > as(list(), "A") > get(".MTable",