The class "ecdf" inherits from the class "stepfun". If f
is such an empirical cumulative density function,
both is.stepfun(f)
and is(f,"stepfun")
are TRUE
, and as.stepfun(f)
doesn't do anything as expected.
But conversion of f
to "stepfun" by as(f,"stepfun")
is impossible because of the "metadata", even if strict
is FALSE
:
f <- ecdf(1:10)
class(f)
# [1] "ecdf" "stepfun" "function"
is.stepfun(f)
# [1] TRUE
is(f,"stepfun")
# [1] TRUE
identical(f,as.stepfun(f))
# [1] TRUE
g <- as(f,"stepfun",strict=FALSE)
# Error in as(f, "stepfun", strict = FALSE) :
# internal problem in as(): “ecdf” is(object, "stepfun") is TRUE, but the metadata asserts that the 'is' relation is FALSE
So how is is
related to as
and what is the meaning of the "metadata" here?