[R] Help with classes and generic function

From: Pryseley Assam <assampryseley_at_yahoo.com>
Date: Sat 25 Feb 2006 - 01:55:05 EST

Hello R-Users    

  I am pretty new to R and forgive me if my questions are "childish" , nevertheless i need help.    

  I have some problems while trying to grasp the idea of a generic function. I understand that i have to build methods with naming syntax "function.class", where class is the CLASS of an (first) object passed to the generic function, and is used to decide which method shall be invoked.    

  Suppose i have a function say,    

  unis <- function(x,y,...){ ..function body...}    

  and i call the function, assigning the result to an object say,    

  results <-unis(outcome, trial, ..)    

  now i want the object, results, to have a particular CLASS say "surr" so that i can define methods like    


  My main trouble is:
  what do i need to do, so that any object assigned the value from a call of the function unis has CLASS as "surr"    


        [[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 Sat Feb 25 02:22:57 2006

This archive was generated by hypermail 2.1.8 : Sat 25 Feb 2006 - 03:08:48 EST