[Rd] understanding virtual classes and extensions thereof

2006-10-20 Thread Parlamis Franklin
I am having some trouble creating a hierarchy of virtual classes (akin to the class structure in the 'Matrix' package). I think they arise from my not understanding the best way to specify virtual subclasses of a virtual class. please see questions below code. setClass(mom)

[Rd] default arguments in generics and methods

2006-10-19 Thread Parlamis Franklin
i believe the following is true but would appreciate confirmation that it is intended behavior and will continue: if a default argument is employed in the definition of a generic function, and the generic is called with the argument in question (call it 'ARG') missing, then the method for

[Rd] potential setClass bug (with user-defined environment)

2006-09-27 Thread Parlamis Franklin
the following returns an error in an 'exists' call on my machine MyEnv - new.env() setClass(Numeric, numeric, where=MyEnv) franklin parlamis version _ platform powerpc-apple-darwin8.7.0 arch powerpc os darwin8.7.0 system powerpc, darwin8.7.0

Re: [Rd] generics for primitive functions

2006-09-23 Thread Parlamis Franklin
, WeirdNumber, function(x) Weird) [1] Math xx = new(WeirdNumber, 1:10) sqrt(xx) [1] Weird Parlamis Franklin wrote: i think these two code snippets exhibit a bug. they are identical but for the inclusion of an initial line in snippet [2] [1] setMethod(Math, signature(x = numeric), function(x

[Rd] validity testing as part of '@-'

2006-09-21 Thread Parlamis Franklin
'methods' package feature request / discussion starter: perhaps a call to 'validObject' should occur at part of any slot replacement operation (and the operation not be carried out if it would invalidate the object)? this may prevent the need for prophylactic 'validObject' calls in other

[Rd] residual '*tmp*' variable after [- error

2006-09-20 Thread Parlamis Franklin
self-sanity check prior to filing a bug report: attempted replacement that generates an error leaves a '*tmp*' variable in the global environment. test - 1:10 test[2:4] - expression(e) ls() i've read section 3.4.4 of the R Language Definition which discusses the mechanism for replacement,

[Rd] attributes of S4 objects

2006-09-14 Thread Parlamis Franklin
I am having a bit of a struggle deciding when to use attributes with S4 objects. Clearly the 'class' attribute will always be present. But it is not clear to me whether the architects of the methods package intend that other attributes, such as 'names', will still be used when the S4

Re: [Rd] setMethod(Summary)

2006-09-04 Thread Parlamis Franklin
i believe, if the function you are trying to work with has ... as the first formal argument (as do most if not all of the Summary group functions), you will need to redefine the generic in order to provide a real S4 argument on which to dispatch. the following works for me (IIRC it was

Re: [Rd] S4 methods for +

2006-08-25 Thread Parlamis Franklin
If you plan to do this for certain (non-primitive) Math and Math2 group functions you will also need setGeneric calls of this form: setGeneric(log, group=Math) This much is documented in the group generic doc page. What is undocumented (AFAIK), and tripped me up for a while before Martin, I

Re: [Rd] S3 fonctions for object of S4 class

2006-08-23 Thread Parlamis Franklin
Franck: I suspect you'll have to include the exact wording of the relevant setGeneric and setMethod calls (as well as any other functions called in your method) to get an answer to your question. I just did: setGeneric(start, function(x, ...) standardGeneric(start)) [1] start

[Rd] @ accesses attributes, not just formal slots ?

2006-05-11 Thread Parlamis Franklin
Using the '@' operator, I am able to extract a 'names' attribute assigned to a formal object. However, I can not use the replacement form ('@-') to assign that attribute. setClass(foo, representation(numeric)) [1] foo (new(foo, 1:4)-a) An object of class “foo” [1] 1 2 3 4 names(a) -

[Rd] methods for @ operator

2006-05-01 Thread Parlamis Franklin
i often find myself having a list of similarly-classed S4 objects and needing a list containing a particular extracted slot from those objects. so i did the following: setMethod(slot, signature(object = list), + function(object, name) + lapply(object, function(i)