# Two test for a class like this: setClass("XXX", representation=representation( "matrix" ) )
i<-new("XXX"); m=matrix(); colnames(m)<-c("colA"); i...@.data=m; # >i # An object of class “XXX” # colA #[1,] NA #________________________________________________________________________ #First Test "varnames<-" <- function(x,value){ colnames(x...@.data)<-value; } #========================================================== #Result: # > varnames(i)<-c("a") # > i # [1] "a" # x lost class type an value from XXX to vector. #________________________________________________________________________ # Second Test "varnames<-" <- function(x,value){ m...@.data; colnames(m)<-value; print(names(m)) #Ok the matrix is here. slot(x,".Data")<-m; } #========================================================= #Result: # x lost class type and value from XXX to matrix. # > varnames(i)<-c("colT") # > i # colT # [1,] NA # > class(i) # [1] "matrix" some idea? Enrique Garzo Cano -Biology Graduate. Ph.D. student.- enrique.garzo.c...@gmail.com Departamento de Ciencias Biomédicas (Área de Fisiología) Facultad de Veterinaria Universidad de León 24071 León (Spain) Tel: +34 987 291981 Fax: +34 987 291267 ______________________________________________ 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.