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
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
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]>):
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
>
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
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
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
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)
> "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
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
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
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
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
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
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,
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
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
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
> 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?
>>
>
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
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
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
22 matches
Mail list logo