[R] Missing arguments to new
J Swinton
js229 at yahoo.com
Fri Dec 19 14:38:37 CET 2003
Is this the expected and/or correct behaviour? And if
so, how do I persuade new to interpret a named but
missing argument as missing?
-------------
setClass("testMissing",representation(a="numeric"),prototype=list(a=0));
showMissing <- function(real.arg,missing.arg) {
really.missing <- new("testMissing");
show(really.missing);
really.there <- new("testMissing",a=1);
show(really.there);
arg.there <- new("testMissing",a=real.arg);
show(arg.there);
arg.missing <- new("testMissing",a=missing.arg);
show(arg.missing);
}
> showMissing(real.arg=2)
An object of class "testMissing"
Slot "a":
[1] 0
An object of class "testMissing"
Slot "a":
[1] 1
An object of class "testMissing"
Slot "a":
[1] 2
Error in initialize(value, ...) : Argument
"missing.arg" is missing, with no default
----------
Jonathan Swinton
=====
Jonathan Swinton; jonathan at swintons.net
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
More information about the R-help
mailing list