[Rd] Legend to a heatmap

2006-02-14 Thread Vasundhara Akkineni
List, I want to add a color legend to a heatmap , similar to the one in levelplot and filled.contour plot. The legend should contain the colors used in the heatmap along with values for each color range. Can this be done? Please help. Thanks, Akkineni. [[alternative HTML version deleted]

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

[Rd] S4 classes and methods with optional arguments

2006-02-14 Thread Josef Leydold
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

Re: [Rd] addmargins

2006-02-14 Thread Prof Brian Ripley
On Mon, 13 Feb 2006, J. Hosking wrote: > > addmargins(UCBAdmissions, FUN = list(Total=sum)) > > works with no problems, but consider: > > > myFUN <- list(Total=sum) > > addmargins(UCBAdmissions, FUN = myFUN) > Error in "names<-.default"(`*tmp*`, value = "") : > names() applied to a non-vec

Re: [Rd] MinGW and the ld bug

2006-02-14 Thread Henrik Bengtsson
On 2/13/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > I believe the bug is triggered by the fairly unusual event you have a '.' > in the package name, and the change in 2.2.1 to 2.2.1 patched was to add > > > LIBRARY R.native.dll > > (which is what my workaround in ld.e