[Rd] S4 Slot assignment within function

2011-06-04 Thread mcguirebc
Is there a simple way to assign values to S4 slots from within a function? Doing this doesn't work: assign_slot-function(x){ assign(OBJECT@slot,x,envir=parent.env(environment()) } assign_slot(x) All I get from this is a new object with the name OBJECT@slot, the slot assignment of OBJECT

Re: [Rd] S4 Slot assignment within function

2011-06-04 Thread Duncan Murdoch
On 11-06-03 5:03 PM, mcguirebc wrote: Is there a simple way to assign values to S4 slots from within a function? Doing this doesn't work: assign_slot-function(x){ assign(OBJECT@slot,x,envir=parent.env(environment()) } assign_slot(x) All I get from this is a new object with the name

Re: [Rd] S4 Slot assignment within function

2011-06-04 Thread Martin Morgan
On 06/03/2011 02:03 PM, mcguirebc wrote: Is there a simple way to assign values to S4 slots from within a function? Doing this doesn't work: assign_slot-function(x){ assign(OBJECT@slot,x,envir=parent.env(environment()) } assign_slot(x) All I get from this is a new object with the name