[EMAIL PROTECTED] wrote:
> Sorry to come back on callNextMethod, I am still not very confident
> about it.
>
> Consideres the following (there is a lot of code, but very simple with
> almost only some cat) :
>
> --
> setClass("A",representation(a="numeric"))
> setValidity("A",fu
Sorry to come back on callNextMethod, I am still not very confident about it.
Consideres the following (there is a lot of code, but very simple with
almost only some cat) :
--
setClass("A",representation(a="numeric"))
setValidity("A",function(object){cat(" * Valid A *\n")
[EMAIL PROTECTED] wrote:
>> The code example is incomplete, so I don't really know why one version
>> assigned y=3 for you and the other did not; for me, neither version
>> did the assignment.
>
> I probably add the return in the mail without imagining il will change
> things.
>
> My question
> The code example is incomplete, so I don't really know why one
> version assigned y=3 for you and the other did not; for me, neither
> version did the assignment.
I probably add the return in the mail without imagining il will change things.
My question was more on the use of ... versus the a
[EMAIL PROTECTED] wrote:
>> callGeneric is an advanced topic.
>
> Ok, when I will be older :-)
>
>>> *
>>> This works :
>>>
>>> setMethod("initialize","B",
>>> function(.Object,..., yValue){
>>> callNextMethod(.Object, ..., y=yValue)
>>>
> callGeneric is an advanced topic.
Ok, when I will be older :-)
>> *
>> This works :
>>
>> setMethod("initialize","B",
>> function(.Object,..., yValue){
>> callNextMethod(.Object, ..., y=yValue)
>> return(.Object)
>> })
>> new("
[EMAIL PROTECTED] wrote:
> Hi Martin
>
> I am re reading all the mail we exchange with new eyes because of all
> the thing I learn in the past few weeks. That very interesting and some
> new question occurs...
>
> ***
> Once, you speak about callGeneric :
>
> se
Hi Martin
I am re reading all the mail we exchange with new eyes because of all
the thing I learn in the past few weeks. That very interesting and some
new question occurs...
***
Once, you speak about callGeneric :
setClass("A", representation(x="numeric"))
setC
Hi Martin
I was not that much speaking about what we can do, but more about what
we can't. We can't decide that object will be 'never empty', we have to
allow empty oject, otherwise new("A") will not work and that will be
problematic.
So, at this point, I see :
- it is necessary to allow the
[EMAIL PROTECTED] writes:
> Well well well...
You're partly misunderstanding...
> To summarize : let assume that A is a class (slot x) and C is a class
> containing A (A and slot y) - as(c,"A") calls new("A"). So new("A")
> HAS TO works, you can not decide to forbid empty object (unless you
> de
Well well well...
To summarize : let assume that A is a class (slot x) and C is a class
containing A (A and slot y) - as(c,"A") calls new("A"). So new("A") HAS
TO works, you can not decide to forbid empty object (unless you define
setAs("C","A") ?)
- In addition, any test that you would like to
[EMAIL PROTECTED] writes:
> Hi Martin, thanks for your answer
>
>> But a couple
>> of other quick points. I would have written
>>
>> setMethod("initialize", "A",
>> function(.Object, ..., xValue=numeric(0)){
>> callNextMethod(.Object, ..., x=xValue)
>> })
>>
>
> I am
Hi Martin, thanks for your answer
> But a couple
> of other quick points. I would have written
>
> setMethod("initialize", "A",
> function(.Object, ..., xValue=numeric(0)){
> callNextMethod(.Object, ..., x=xValue)
> })
>
I am not that much familiar with S3... In our
Hi Christophe --
This is a variant of the problem that Jim Regetz is having in a thread
in R-devel. Here's where the trouble is
> as(c, "A")
Error in .local(.Object, ...) :
argument "value" is missing, with no default
By default, 'as(c, "A")' will create a new instance of it's second argument
Thanks Martin
Well it works except that "as" seems to not like the "initialize" method
: the following code (that is the same than yours with some initialize
for A B and C) does not compile. It seems that as(c,"A") does not work
if we definie a initialize for A...
--- 8< --
setClas
Hi Christophe --
I don't know whether there's a particularly elegant way. This works
setClass("A", representation(x="numeric"))
setClass("B", representation(y="numeric"))
setClass("C", contains=c("A", "B"))
setMethod("show", "A", function(object) cat("A\n"))
setMethod("show", "B", function(obje
Hi the list
I define a class A (slot a and b), a class C (slot c and d) and a class
E that inherit from A and B.
I define print(A) and print(B). For print(C), I would like to use both
of them, but I do not see how...
Thanks for your help...
Christophe
-
17 matches
Mail list logo