[R] own TAB expansion

Sebastian Gibb lists at sebastiangibb.de
Fri Oct 8 15:19:10 CEST 2010


Hello Duncan,

thank for your advice, but it doesn't work like expected:

setClass(Class="A", representation=representation(slotA="numeric", 
slotB="numeric"));
setMethod("$", "A", function(x, name) {return(slot(x, name));})
setGeneric(".DollarNames")
setMethod(".DollarNames", signature(x="A"), function(x, 
pattern)grep(pattern=pattern, x=c("slotA", "slotB"), value=T))

a <- new("A", slotA=1, slotB=2)
a$sl  <TAB> 
# doesn't print slotA/slotB
> a$

What I'm doing wrong?

Bye,

Sebastian



More information about the R-help mailing list