Robert Bauer
2014-Apr-15 09:55 UTC
[R] generic function-method arguments accessible by tab-key
Hi, I have the following problem: I wrote a Generic Function that comes with a bunch of different methods and even more arguments. It's kind like this: if ( !isGeneric("v") ) { setGeneric("v", function(x, ...) standardGeneric("v")) } setMethod('v', signature(x='character'), function(x,...){ print(x) } ) So what I don't know is how to porgram the function in a way that when typing the function in the R-console one can see all available arguments, using the 'tab-key' for all the different methods of the function that are actually masked by the three dots, like: as.matrix( so that I see: as.matrix(x ... row.names.force= sep= byrow another example is the generic function that shows all arguments is the plot()-function I figured out that these functions come with different subfunctions, like as.matrix.default, as.matrix.spam, but when adding a sub.function: v.print, the arguments do not show up by the v: v.print <- function(x,y='',z=''){ print(paste(x,y,z)) } i thought to link the v and the v.print function, but this did not bring the anticipated result neither: if ( !isGeneric("v") ) { setGeneric("v", function(x, ...) standardGeneric("v")) } setMethod('v', signature(x='character'), function(x,y=x,z=x){ v.print(x,y=y,z=z) } ) maybe that's not the right way... any ideas? thx very much in advance! robert -- View this message in context: http://r.789695.n4.nabble.com/generic-function-method-arguments-accessible-by-tab-key-tp4688793.html Sent from the R help mailing list archive at Nabble.com.
Robert Bauer
2014-Apr-15 10:13 UTC
[R] generic function-method arguments accessible by tab-key
just a note i liked to add: so the idea is just to have the optional arguments y and z showing up in the the v-function call using the tab-key -- View this message in context: http://r.789695.n4.nabble.com/generic-function-method-arguments-accessible-by-tab-key-tp4688793p4688794.html Sent from the R help mailing list archive at Nabble.com.