Witold E Wolski <wewolski <at> gmail.com> writes:
>
> Have a class for which I would like to provide a "colnames<-.myclass"
> function so that
>
> colnames(myintsance) <- c("a","b","c")
> can be called.
`colnames<-` is not generic as Luca noted.
But `dimnames<-` is.
If you write a suitable `dimnames<-.myinstance`, then `colnames<-` will
find it.
`dimnames<-.data.frame` gives an example.
I think you will want to either call NextMethod() or replace
attr(x,"dimnames") and return x. That is, you probably do not want to
use `dimnames<-`inside `dimnames<-.myinstance`.
HTH,
Chuck
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel