Hi So how would I actually implement it - what is the signature?
"dimnames<-.myclass" <- function(data,newnames){ colnames(data) = newnames return(data) } ? On 14 May 2014 11:53, Martin Maechler <maech...@stat.math.ethz.ch> wrote: > DO *NOT* post to both R-help and R-devel !! > That is considered *very* impolite. > > As this is a question for R-help only, i.e., not fit for > R-devel anyway : > > >>>>> Witold E Wolski <wewol...@gmail.com> > >>>>> on Wed, 14 May 2014 10:57:09 +0200 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. > > This is not easily possible, as `colnames<-` is *not* a generic > function. OTOH, this is not necessary either, as > colnames, rownames are basically just short cuts for dimnames anyway: > > As `dimnames<-` *is* a generic function, > so you write methods for `dimnames<-`. > > Martin > > > -- > > Witold Eryk Wolski > > > [[alternative HTML version deleted]] > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Hmm,... > -- 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.