This issues a message about a needing to be non-negative as expected:
setClass("A",
representation = list(a = "numeric"),
prototype = list(a = 0),
validity = function(object) {
out <- if (object@a < 0) "a must be non-negative"
if (is.null(out)) TRUE else out ##
})
new("A", a = -1)
On Thu, Feb 28, 2013 at 3:44 PM, Gabor Grothendieck
wrote:
> This issues a message about a needing to be non-negative as expected:
>
> setClass("A",
> representation = list(a = "numeric"),
> prototype = list(a = 0),
> validity = function(object) {
> out <- if (object@a < 0) "a must be no