Displaying 2 results from an estimated 2 matches for "foowfcn".
2005 Dec 29
1
S4 classes: referencing slots with other slots
...That being said, I want to know if it's possible to reference a slot
in an S4 class from another slot, i.e. I'd like to have the "self.*"
semantics of Python so that I can reuse a slot. That is, for various
reasons it would be nice to be able to do something like:
setClass("fooWfcn",
representation(dat1="vector",
dat2="vector",
fn1="function",
fn2="function"),
prototype=list(dat1=0:10,
dat2=10:20,
fn1=function(x) { return...
2011 Feb 21
0
[R] S4 classes: referencing slots with other slots
Dear Development Group,
In trying to answer the subject question myself, I found this thread
initiated by Tony from five years ago:
http://tolstoy.newcastle.edu.au/R/help/05/12/18169.html. I recently stumbled
upon the following S4 answer to Tony's question:
setClass("fooWfcn",
representation(dat1="vector",
dat2="vector",
fn1="function",
fn2="function"),
prototype=prototype(dat1=0:10, dat2=10:20)
)
setMethod("initialize", "fooWfcn", function(.Object, ...) {
.Object...