the ecdf class inherits from the stepfun class. If f is such an empirical cumulative density function, both is.stepfun(f) and is(f,"stepfun") are TRUE , and as.stepfun(f) does nothing as expected. But converting f to "stepfun" to as(f,"stepfun") not possible 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) :
So, how is related to as and what is the meaning of "metadata" here?
mra68 source share