Displaying 20 results from an estimated 8000 matches similar to: "is() and S3 classes"
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi,
The unary forms of is() and extends() report that data.frame
extends list, oldClass, and vector:
> is(data.frame())
[1] "data.frame" "list" "oldClass" "vector"
> extends("data.frame")
[1] "data.frame" "list" "oldClass" "vector"
However, the binary form of is()
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
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
2017 Nov 29
2
binary form of is() contradicts its unary form
Yes, data.frame is not an S4 class but is(data.frame())
finds its super-classes anyway and without the need to wrap
it in asS4(). And "list' is one of the super-classes. Then
is(data.frame(), "list") contradicts this.
I'm not asking for a workaround. I already have one with
'class2 %in% is(object)' as reported in my original post.
'is(asS4(object), class2)'
2007 Jan 24
1
how to properly extend s3 data.frames with s4 classes?
Dear R Programmers!
After some time of using R I decided to work through John Chambers book
"Programming with Data" to learn what these S4 classes are all about and
how they work in R. (I regret not having picked up this rather fine book
earlier!)
I know from the documentation and the mailing archives that S4 in R is
not 100% the book and that there are issues especially with
2004 Jun 18
0
Problem with setValidity() or resetClass() or ... ?
Hi,
I'm working with Version 1.9.0 (2004-04-12) on Windows 98/NT/2000 where
I found the following wrong (?) behavior of setValidity().
I already mentioned this on the R-help list (2004-06-11, was
"setValidity changes Extends?") , but as I got no answer I tried to
figure out what's happening.
Well, setValidity() behaves not as I would expect (something about the
2017 Nov 29
0
binary form of is() contradicts its unary form
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.`
Note that object class is always `data.frame` here, check:
> class(data.frame())
[1] "data.frame"
> is(data.frame(), "data.frame")
[1] TRUE
Best,
Mehmet
On 29 Nov
2003 Aug 05
3
s4 methods and base
I'm sure that many people are in the same position as me in that they are
trying to write packages and code that is vaguely "future proof".
Would it be possible to get some guidance on how the R-core team see the
evolution of the "base" package with regard to s4 methods.
There seem to be quite a lot of inconsistencies between s3 and s4 methods
and classes currently and
2017 Nov 29
0
binary form of is() contradicts its unary form
Hi Herve,
Interesting observation with `setClass` but it is for S4. It looks
like `data.frame()` is not an S4 class.
> isS4(data.frame())
[1] FALSE
And in your case this might help:
> is(asS4(data.frame()), "list")
[1] TRUE
Looks like `is` is designed for S4 classes, I am not entirely sure.
Best,
-Mehmet
On 29 November 2017 at 20:46, Herv? Pag?s <hpages at
2020 Jan 21
2
class(<matrix>) |--> c("matrix", "arrary") -- and S3 dispatch
Dear Martin,
What's the ETA for _R_CLASS_MATRIX_ARRAY_=TRUE to become the new
unconditional behavior in R devel? Thanks!
H.
On 11/21/19 08:57, Martin Maechler wrote:
>
> TLDR: This is quite technical, still somewhat important:
> 1) R 4.0.0 will become a bit more coherent: a matrix is an array
> 2) Your package (or one you use) may be affected.
>
>
2018 May 16
1
Dispatch mechanism seems to alter object before calling method on it
On 05/16/2018 01:24 PM, Michael Lawrence wrote:
> On Wed, May 16, 2018 at 12:23 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>> On 05/16/2018 10:22 AM, Michael Lawrence wrote:
>>>
>>> Factors and data.frames are not structures, because they must have a
>>> class attribute. Just call them "objects". They are higher level than
>>>
2004 Aug 14
2
Private methods
Hi,
I'm trying to understand R's object oriented abilities.
I have read (in a very recent email to r-help) that R's methods package
does not support private methods. However, I also looked at the source
for the function "is":
> is
function (object, class2)
{
cl <- .class1(object)
if (missing(class2))
return(extends(cl))
if (.identC(cl, class2)
2018 May 16
2
Dispatch mechanism seems to alter object before calling method on it
On 05/16/2018 10:22 AM, Michael Lawrence wrote:
> Factors and data.frames are not structures, because they must have a
> class attribute. Just call them "objects". They are higher level than
> structures, which in practice just shape data without adding a lot of
> semantics. Compare getClass("matrix") and getClass("factor").
>
> I agree that
2009 Sep 15
2
S3 objects in S4 slots
Hello,
I am the maintainer of the stringkernels package and have come across
a problem with using S3 objects in my S4 classes.
Specifically, I have an S4 class with a slot that takes a text corpus
as a list of character vectors. tm (version 0.5) saves corpora as
lists with a class attribute of c("VCorpus", "Corpus", "list"). I
don't actually need the
2006 Jan 12
2
Finding by association
I have two objects that are associated in the following way:
class Class1 < ApplicationController
has_and_belongs_to_many :class2s
has_and_belongs_to_many :otherClasses
end
class Class2 < ApplicationController
has_and_belongs_to_many :class1s
has_and_bleongs_to_many :otherClasses
end
Now, when I run the following query,
@objects = Class1.find(:all, :conditions
2004 Dec 17
1
h323 channel compile error
Hi,
Can anyone help? I get the following error when trying to complie the h323 channel under the source installation directory
asterisk/channels/h323
i have read the readme file and kept to the recomended versions; h.323 v1.12.2 and PWLIB v1.5.2
Thanks in advance
[root@gw01 h323]# make
g++ -g -c -fno-rtti -o ast_h323.o -march=i686 -DPBYTE_ORDER=PLITTLE_ENDIAN -DNDE
BUG -DDO_CRASH
2005 Aug 06
1
oldClass vs. class
Hi,When I read the source of str,i find these code
-----
## Show further classes // Assume that they do NOT have an own Method --
## not quite perfect ! (.Class = 'remaining classes', starting with current)
cl <- oldClass(object); cl <- cl[cl != "data.frame"] #- not THIS class
-----
so I use ?oldClass to try to learn more about oldClass.But after I have reading
2001 Feb 26
1
"untable" function
Dear R-users!
I am using R1.2.0 under Windows NT4.0, and have data of the following form:
> #simple example of data structure:
> x <- data.frame(group=LETTERS[1:3], class1=1:3, class2=4:6)
> x
group class1 class2
1 A 1 4
2 B 2 5
3 C 3 6
I would like to convert this to a data.frame y of the following form:
> y
group class counts
1
2006 Apr 04
1
Added method to ActiveRecord Class
Hi,
Let''s say:
class Class2 << ActiveRecord
belongs_to: class1
end
class Class1 << ActiveRecord
has_many :class2s
def get_max_class2
?how to get the max of class2 list ?
end
end
I would like to know how I have to write the get_max_class2 method
in order to have the max value of the class2 list ?
I would like to call this method this way:
class2_max
2006 Dec 12
1
strings as factors
Hi,
To be able to match cases with a benchmark I need to have a data.frame with
a character id variable. however, I am surprised why this seems to be so
hard. In fact I was unable to succeed. Here is what I tried:
>test1 <-expand.grid(ID = 1:2, sex = c("male","female"))
>is(test1[,2])
[1] "factor" "oldClass"
>test2 <-expand.grid(ID =