[R] generic function-method arguments accessible by tab-key
Robert Bauer
robertbauer1603 at gmx.de
Tue Apr 15 11:55:13 CEST 2014
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.
More information about the R-help
mailing list