[Rd] [R] S3 - how to implement "colnames<-"
luca.cerone at gmail.com
Wed May 14 11:42:02 CEST 2014
you should first of all redefine colnames to use UseMethod.
Then you have to write a colnames.default that uses base::colnames
(so that it does not interfere with existing code and other functions)
and the you can define the method for your class.
I would suggest, though, to use attributes for your object, rather
than risking to mess up the default R function.
Hope it helps,
2014-05-14 10:57 GMT+02:00 Witold E Wolski <wewolski at gmail.com>:
> 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.
> Witold Eryk Wolski
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Tel: +34 692 06 71 28
More information about the R-devel