R: How come that "is" is TRUE, but "as" is impossible? -
the class "ecdf" inherits class "stepfun". if f such empirical cumulative density function, both is.stepfun(f) , is(f,"stepfun") true, , as.stepfun(f) doesn't expected. conversion of f "stepfun" as(f,"stepfun") impossible because of "metadata", if strict 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") true, metadata asserts 'is' relation false so how is related as , meaning of "metadata" here?
i may have found relevant information. @ this nabble archive
but has 2 problems: 1) as() s4 method not work (problem 2 not relevant)
locally :-) this question has warnings trying use as()
so suggestion stick as.stepfun(foo) .
Comments
Post a Comment