Il class "ecdf" eredita dalla classe "stepfun". Se f
è una funzione di densità cumulativa empirica, eee as.stepfun(f)
non fanno nulla come previsto. Ma la conversione di f
a "stepfun" di as(f,"stepfun")
è impossibile a causa della "metadati", anche se strict
è FALSE
:R: Come mai che "è" è VERO, ma "come" è impossibile?
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
Così come è is
legato alla as
e qual è il significato della "metadati" Qui?
intendevi 'is.stepfun (f)' subito dopo 'class (f)'? –
Mi interessa - dove hai scavato il formato 'is (item, typedef)' al contrario del formato in tutte le pagine di aiuto 'is.typedef (item)'? Potresti anche voler provare 'methods (as)' e un paio di ricerche simili per vedere cosa sta succedendo con la classe 'stepfun' in particolare. –
@Carl Witthoft: la ricerca di "R coercing" conduce alla [documentazione per il metodo 'as'] (https://stat.ethz.ch/R-manual/R-devel/library/methods/html/as. html). Vi è un collegamento ([setIs] (https://stat.ethz.ch/R-manual/R-devel/library/methods/html/is.html) alla [documentazione per il metodo 'is'] (https://stat.ethz.ch/R-manual/R-devel/library/methods/html/is.html). – mra68