[R] Is there a diferent way to do this?

From: Gilvan Justino <giljustino_at_yahoo.com.br>
Date: Sun 27 Mar 2005 - 08:59:12 EST


Hi,  

I started creating a small class but I'm courious about how it is working.  

To create a instance of my class "Partri" I write this at Rgui: x <- new("Partri", name="Gilvan")  

and to change the slot "name" of this instance, I write: setName(x, newname="Justino")  

It is not working, because when I type "x" at Rgui, it shows the initial value, which was "Gilvan". What I am doing wrong?  

I'll appreciate any king of help!
Gilvan    

# Classe para representar um parâmetro
setClass("Partri",

# parâmetros

   representation( name="character"),
# seção de inicialização

   prototype( name="undefined name" )
)

setGeneric("setName",

           function(object, newname,...)
           standardGeneric("setName"))
setMethod("setName", 
          signature(object="Partri",newname="character"),        
          function(object, newname)
          {
            object@name = newname
          }
          )


		
---------------------------------

ora!
	[[alternative HTML version deleted]]

______________________________________________
R-help@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 Received on Sun Mar 27 09:04:33 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST