Re: [Rd] S4 classes and S3 generic functions

2010-06-13 Thread John Chambers
There are number of examples in the documentation, as noted, illustrating different situations. Here is one of them. Of course, to "enter and run" it you need rev 52267. --- setClass("classA", contains = "numeric", representation(realData = "numeric")) Math.classA <- function(x) {(get

Re: [Rd] S4 classes and S3 generic functions

2010-06-13 Thread Gabor Grothendieck
On Sun, Jun 13, 2010 at 6:58 PM, John Chambers wrote: > A general goal for the next version of R is to make S4 and S3 play better > together. > > As mentioned in a previous thread, one limitation has been that S3 generic > functions, specifically the UseMethod() call, did not make use of S4 > inhe

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Jörg Beyer
Gabor, Roger, thanks a lot for your immediate answers. Knowing that this is subject to change means a lot less coding for me :-) Good news ... for me, and first of all for the impressing S4 system. Thanks again Joerg Am 28.08.2006 16:08 Uhr schrieb Gabor Grothendieck (<[EMAIL PROTECTED]>):

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Roger D. Peng
I think you're right---this shouldn't happen in theory, but it does because of the internal representation of S4 objects in R. In R devel (to be 2.4.0), this changes and I believe your example will no longer work. -roger Jörg Beyer wrote: > Hello. > > Suppose you define a new S4-class, say >

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Gabor Grothendieck
Under R 2.3.1 these work as you indicate but under R 2.4.0 they all give errors: > setClass("track", representation(x="numeric", y="numeric")) [1] "track" > tr <- new( "track" ) > tr[ "ping" ] <- "pong" Error in "[<-"(`*tmp*`, "ping", value = "pong") : object is not subsettable > tr$bi

Re: [Rd] S4 Classes

2006-08-10 Thread Martin Morgan
Gordon Smyth <[EMAIL PROTECTED]> writes: > Is there a capability that you would like for the package which could > be achieved only if the package was transitioned to S4? If so, > explain this to the author. If not, why ask them to change? 'achieved only if' sounds a bit strong. I've used S4 ob

Re: [Rd] S4 Classes

2006-08-10 Thread Gordon Smyth
Is there a capability that you would like for the package which could be achieved only if the package was transitioned to S4? If so, explain this to the author. If not, why ask them to change? Gordon >[Rd] S4 Classes >Daniel Gerlanc dgerlanc at gmail.com >Thu Aug 10 23:37:15 CEST 2006 > >Hello

Re: [Rd] S4 classes and C

2006-05-19 Thread Ross Boylan
On Fri, 2006-05-19 at 11:46 +0200, Martin Maechler wrote: > > "Seth" == Seth Falcon <[EMAIL PROTECTED]> > > on Thu, 18 May 2006 12:22:36 -0700 writes: > > Seth> Ross Boylan <[EMAIL PROTECTED]> writes: > >> Is there any good source of information on how S4 classes (and methods)

Re: [Rd] S4 classes and C

2006-05-19 Thread Martin Maechler
> "Seth" == Seth Falcon <[EMAIL PROTECTED]> > on Thu, 18 May 2006 12:22:36 -0700 writes: Seth> Ross Boylan <[EMAIL PROTECTED]> writes: >> Is there any good source of information on how S4 classes (and methods) >> work from C? Hmm, yes; there's nothing in the "Writing R Ext

Re: [Rd] S4 classes and C

2006-05-18 Thread Seth Falcon
Ross Boylan <[EMAIL PROTECTED]> writes: > Is there any good source of information on how S4 classes (and methods) > work from C? > > E.g., for reading > how to read a slot value > how to invoke a method > how to test if you have an s4 object You might look at Bioconductor's Ruuid package. It doe

Re: [Rd] S4 classes and C

2006-05-18 Thread Ross Boylan
On Thu, 2006-05-18 at 13:53 -0400, McGehee, Robert wrote: > I believe the paper on which those lecture notes were based can be found > here: > http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Drafts/BatesDebRoy.pdf > Thank you. It looks as if it has some useful stuff in it. Ross

Re: [Rd] S4 classes and C

2006-05-18 Thread McGehee, Robert
I believe the paper on which those lecture notes were based can be found here: http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Drafts/BatesDebRoy.pdf -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ross Boylan Sent: Thursday, May 18, 2006 1:45 PM To: R De

Re: [Rd] S4 classes and methods with optional arguments

2006-02-14 Thread Seth Falcon
On 14 Feb 2006, [EMAIL PROTECTED] wrote: > It seems to me like the generic should (always?) just have arguments > used for dispatch -- stream, in this case -- and that methods then > specify default values. There are advantages to adding named arguments to a generic to define the expected interf

Re: [Rd] S4 classes and methods with optional arguments

2006-02-14 Thread Martin Morgan
Echoing similar suggestions, but with a bit of philosophy... How about: setGeneric("rstream.sample", function( stream, ... ) standardGeneric("rstream.sample")) setMethod("rstream.sample", c( "numeric" ), function( stream, n = 1, ... ) { code } ) It seems to me like the gene

Re: [Rd] S4 classes and methods with optional arguments

2006-02-14 Thread Prof Brian Ripley
The problem is not the optional argument, but the attempt to dispatch on an argument not in the generic. setGeneric("rstream.sample", function(stream, ...) standardGeneric("rstream.sample")) setMethod("rstream.sample", "rstream", function(stream,n=1) { print(n) } ) rstream.sample(rs,

Re: [Rd] S4 classes and methods with optional arguments

2006-02-14 Thread Seth Falcon
Hi Josef, On 14 Feb 2006, [EMAIL PROTECTED] wrote: > I have used a construct to allow optional arguments: > > if(!isGeneric("rstream.sample")) setGeneric("rstream.sample", > function(stream,...) standardGeneric("rstream.sample")) First, a question: Is this idiom of testing for the generic befor

Re: [Rd] S4 classes in existing packages

2005-11-01 Thread Liaw, Andy
Fritz gave a talk on S4 using pixmap as example at useR! 2004. You might want to start with that. The slides should be on the useR! 2004 web site. Andy > From: Jeff Enos > > Thanks to Dirk Eddelbuettel, Matthias Kohl, Professor Ripley, and > Bernhard Pfaff for their helpful reponses. > > Here

Re: [Rd] S4 classes in existing packages

2005-11-01 Thread Jeff Enos
Thanks to Dirk Eddelbuettel, Matthias Kohl, Professor Ripley, and Bernhard Pfaff for their helpful reponses. Here is a list of the packages they recommended: CRAN: distr distrEx distrSim distrTEst RandVar CoCo DBI IDPmisc Matrix RMySQL ROracle RSQLite RUnit SparseM aod arules boolean coin colorsp

Re: [Rd] S4 classes in existing packages

2005-11-01 Thread Pfaff, Bernhard Dr.
> Jeff Enos schrieb: > >> R-devel, >> >> I'm interested in looking at some examples of existing R packages that >> rely heavily on S4 classes to get a feel for varying styles and >> package organization techniques. Could you recommend any packages >> that might serve as a good starting point? >> >

Re: [Rd] S4 classes in existing packages

2005-11-01 Thread Prof Brian Ripley
On Tue, 1 Nov 2005, Matthias Kohl wrote: > Jeff Enos schrieb: > >> R-devel, >> >> I'm interested in looking at some examples of existing R packages that >> rely heavily on S4 classes to get a feel for varying styles and >> package organization techniques. Could you recommend any packages >> that

Re: [Rd] S4 classes in existing packages

2005-11-01 Thread Matthias Kohl
Jeff Enos schrieb: >R-devel, > >I'm interested in looking at some examples of existing R packages that >rely heavily on S4 classes to get a feel for varying styles and >package organization techniques. Could you recommend any packages >that might serve as a good starting point? > >Thanks in advan

Re: [Rd] S4 classes in existing packages

2005-10-31 Thread Seth Falcon
On 31 Oct 2005, [EMAIL PROTECTED] wrote: > I'm interested in looking at some examples of existing R packages > that rely heavily on S4 classes to get a feel for varying styles and > package organization techniques. Could you recommend any packages > that might serve as a good starting point? I wo