Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-10 Thread Seth Falcon
Hi Markus, On 2/9/10 4:12 PM, Markus Weisner wrote: Thanks so much for your help. I am realizing that I may be over-complicating things for myself. I have learned a ton about creating methods, but I feel like I am trying to reinvent the data.frame class. Basically, I am trying to create a data

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-09 Thread Markus Weisner
Thanks so much for your help. I am realizing that I may be over-complicating things for myself. I have learned a ton about creating methods, but I feel like I am trying to reinvent the data.frame class. Basically, I am trying to create a data.frame type object where I can enforce the header names

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Markus Weisner
Thanks. Used getGeneric("[") to figure out the general format for the setMethod, but am having some problem with how to set up the actual function: > getGeneric("[") standardGeneric for "[" defined from package "base" function (x, i, j, ..., drop = TRUE) standardGeneric("[", .Primitive("[")) Me

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Martin Morgan
On 02/08/2010 02:54 PM, Markus Weisner wrote: > Thanks. Used getGeneric("[") to figure out the general format for the > setMethod, but am having some problem with how to set up the actual > function: > >> getGeneric("[") > standardGeneric for "[" defined from package "base" > > function (x, i, j

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Martin Morgan
On 02/08/2010 01:22 PM, Markus Weisner wrote: > Worked like a charm!! Thank you so much. I just plugged the following into > my code ... > > setMethod("$", "CADresponses", function(x, name) slot(x, name)) > > ... and it worked perfect. If you don't mind, I have a quick follow up > question, us

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Markus Weisner
Worked like a charm!! Thank you so much. I just plugged the following into my code ... setMethod("$", "CADresponses", function(x, name) slot(x, name)) ... and it worked perfect. If you don't mind, I have a quick follow up question, using your example setClass("A", representation(a="numeric",

Re: [R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Martin Morgan
On 02/07/2010 08:31 PM, Markus Weisner wrote: > I created some S4 objects that are essentially data frame objects. The S4 > object definitions were necessary to verify data integrity and force a > standardized data format. I am, however, finding myself redefining all the > typical generic functio

[R] using setMethod or setGeneric to change S4 accessor symbol from @ to $

2010-02-08 Thread Markus Weisner
I created some S4 objects that are essentially data frame objects. The S4 object definitions were necessary to verify data integrity and force a standardized data format. I am, however, finding myself redefining all the typical generic functions so that I can still manipulate my S4 objects as if