Hi Witold, 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, Cheers, Luca 2014-05-14 10:57 GMT+02:00 Witold E Wolski <wewol...@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 > > > -- > Witold Eryk Wolski > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Luca Cerone Tel: +34 692 06 71 28 Skype: luca.cerone ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.