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
Hi,
i have used S4 classes to implement a unified access to random number generators
(package rstream on CRAN).
I have used a construct to allow optional arguments:
if(!isGeneric("rstream.sample"))
setGeneric("rstream.sample", function(stream,...)
standardGeneric("rstream.sample"))
set