[R] set class attribute method question

chenxh007 chenxh007 at gmail.com
Sat Jul 21 03:42:09 CEST 2007


setReplaceMethod("set.version", c("dat", "character"),
                    function(object, value) {
                        object at .version <- value
                        object })

Xiaohui

Tae-Hoon Chung wrote:
> Hi, All;
> 
> Suppose I have a class 'dat' such that setClass('dat', representation 
> (.version='character', x='numeric', y='numeric')).
> If I want to make a method that changes the .version slot of 'dat'  
> class in a way like set.version(d) <- '0.2' when d is an object of  
> 'dat' class, how can I do this? Thanks in advance.
> 
> Tae-Hoon Chung
> 
> Post-Doctoral Researcher
> Computational Biology Division, TGEN
> 445 N 5th St. Phoenix, AZ 85004 USA
> O: 1-602-343-8724
> F: 1-602-343-8840
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list