Displaying 20 results from an estimated 700 matches similar to: "user interface and documentation of setIs and setAs, some suggestions (S4)."
2004 Oct 08
1
Function _coerce_ in _setIs_ never entered (S4).
Hi,
Please consider the following trivial example.
In the sample code I first define a class MVCa using composition. This
class contains a slot of type list.
Next I define an inheritance relation using the function setIs -> MVCa
"is a" list.
Then I define a function printlength which prints the list-length which
is defined for the type "list".
If I call this function
2003 Sep 02
1
completeSubclasses() methods bug (PR#4051)
Full_Name: Colin A. Smith
Version: 1.8.0
OS: Mac OS X 10.2.6
Submission from: (NULL) (128.102.184.81)
annaffy 1.0.1 (in BioC CVS) fails to load. annaffy 1.0 (on the BioC web site)
has the same problem.
It looks like the load is failing because of a bug in completeSubclasses() in
r-devel. It calls setIs() and doesn't specify an environment via the "where"
argument. setIs()
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 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
2020 Oct 06
0
S4 - inheritance changed by order of setClassUnion and setAs()
Andreas,
As far as I can tell (/conjecture), this is because the list of classes a
particular class inherits from directly is appended to as needed, and so
the order that a class extends others isd refined by the order that those
connections are defined.
We can see this with two setClassUnion calls, rather than required setAs:
> setClass("grandma", slots = c(a =
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
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
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
2005 Mar 29
0
setAs between a new S4 class and "POSIXlt"
Dear R core team
Please apologize for posting the same question twice on R-help and
R-devel. Since I was not sure which list is appropriate I tried R-help (Tue
Mar 22), but got no answer.
Now I do not know if the formulation of my question was unclear or the
question is not so easy to answer or to easy (what I do not hope).
My problem: I create a new S4 class, containing one slot, data (of
2005 Mar 22
0
setAs between a new S4 class and "POSIXlt"
Dear R gurus
I've a question concerning the transformation of a new S4 class
(that I defined) and the existing class "POSIXlt". I did the
following:
## Definition of the new class:
setClass("dtime",
representation(data = "POSIXlt"),
prototype(data = as.POSIXlt("2004/06/01")))
## Transformation between the new class "dtime"
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:
2011 Dec 04
0
How to write (complex) coercion methods or "what's the reason to limit 'setAs()' the way it is limited"?
Dear list,
I'd like to write coercion methods for some of my Reference Classes.
However, using 'setAs()' is not a real option as its argument 'def' only
allows for functions depending on one single argument. In some cases,
that is simply too much of a limitation for me. And I don't really see
why it needs to be this way, so I guess this question is also some sort
of a
2003 Sep 08
0
setAs() and namespaces
An example sent by Ross Ihaka points out a non-obvious step needed to
export the results of setAs().
The as() mechanism can't use ordinary method dispatch because the second
argument is the name of a class, not an object from the class. So it
uses a "helper" function, coerce(), and sets methods for that function.
Therefore, if you want to export the results of setAs(), at the
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"))
2004 Sep 08
1
A couple of issues with colClasses/setAs
Consider this:
$ cat test.dat
1 a
2 b
Now, we want to read the 2nd column as a factor and ignore the first
(since it's just a sequential ID). We can't just put "factor" among
the colClasses (would have been nice), so let's try this instead
> setAs("character","factor",as.factor)
Arguments in definition changed from (x) to (from)
>
2002 May 29
1
warning message for setAs when using class AsIs
This seemed too advanced for r-help and is related to the recent discussion of
character vectors in dataframes.
Following Brian Ripley's most excellent advice, we are moving to a world in
which character vectors in dataframes are always of class AsIs. The cool way of
doing this seemed to be the following:
> cat(c("x", "y", "z"), file = "test.txt",
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"))
2016 Mar 19
0
unary class union of an S3 class
On Sat, Mar 19, 2016 at 12:10 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>
>>
>> On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s <hpages at fredhutch.org
>> <mailto:hpages at fredhutch.org>> wrote:
>>
>> Hi,
>>
>> Short story
>> -----------
>>
>>
2003 Mar 31
1
setIs?
I've recently updated from an early February version of 1.7.0 to
Version 1.7.0 Under development (unstable) (2003-03-25)
and am now having problems with errors giving the message:
' getExtends(ClassDef) : @ must be used on an object with a formal class'
which seems to be caused by 'setIs("character","character or NULL")'
which attempts to define
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=