Hi,
I have a problem with the package "survival" in rpy. I have to use the function
survit() , and it works with R but not by calling R from python with rpy :
>>> ss=r.survfit(s,weights=pds)Traceback (most recent call last): File
>>> "<interactive input>", line 1, in ?RPy_RException: Erreur dans
>>> UseMethod("survfit") : pas de méthode applicable pour "survfit"
It seems that there is nothing implemented in rpy for this function...
Do you know how I can manage this problem ? Have I made mistakes ? Or do you
know what function I could use to have similar results ?
If I can provide more information please let me know.best regards,
Lore.
Notes : Perhaps I can code again the survfit() function in pyton... But that
seems really complicated. I have tried but first, I don't know if I have to
code it as a python function (def...) or a R function (function () {...}). And
then, there is a lot of problems such as with the function match.call() which
can be used from outside a function...
function (formula, data, weights, subset, na.action, ...) { call <-
match.call() if ((mode(call[[2]]) == "call" && call[[2]][[1]] ==
as.name("Surv")) || inherits(formula, "Surv")) { formula <-
eval(parse(text = paste(deparse(call[[2]]), 1, sep = "~")))
environment(formula) <- parent.frame() } if (!inherits(formula,
"formula")) temp <- UseMethod("survfit") else { m <-
match.call(expand.dots = FALSE) m$... <- NULL Terms <-
terms(formula, "strata") ord <- attr(Terms, "order") if
(length(ord) & any(ord != 1)) stop("Interaction terms are not valid
for this function") m$formula <- Terms m[[1]] <-
as.name("model.frame") m <- eval(m, parent.frame()) n <- nrow(m)
Y <- model.extract(m, "response") if (!is.Surv(Y))
stop("Response must be a survival object") casewt <- model.extract(m,
"weights") if (is.null(casewt)) casewt <- rep(1, n)
if (!is.null(attr(Terms, "offset"))) warning("Offset term ignored")
ll <- attr(Terms, "term.labels") if (length(ll) == 0)
X <- factor(rep(1, n)) else X <- strata(m[ll]) temp <-
survfit.km(X, Y, casewt, ...) class(temp) <- "survfit" if
(!is.null(attr(m, "na.action"))) temp$na.action <- attr(m,
"na.action") } temp$call <- call temp}
_________________________________________________________________
Microsoft vous recommande de mettre à jour Internet Explorer.
http://specials.fr.msn.com/IE7P25
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list