Skip to content
Back to formatted view

Raw Message

Message-ID: <1353333779978-4650041.post@n4.nabble.com>
Date: 2012-11-19T14:02:59Z
From: Massimo Bressan
Subject: function customization
In-Reply-To: <50AA0910.70700@statistik.tu-dortmund.de>

thank you all for the great  help, in particular to dennis murphy

in order to close the thread I'm posting here the final solution to my
question

new.ex<-structure(list(TEC = c(0.21, 0.077, 0.06, 0.033, 0.014, 0.007, 
                               0.21, 0.077, 0.01, 0.033, 0.05, 0.014), 
                       LR = c(FALSE, FALSE,TRUE, FALSE, TRUE, FALSE, FALSE,
FALSE, TRUE, FALSE, TRUE, TRUE),
                       group = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L,2L, 2L), 
                                         .Label = c("1", "2"), class =
"factor")), 
                                         .Names = c("TEC","LR", "group"),
row.names = c(NA, -12L), class = "data.frame") 


library(NADA)


out<-with(new.ex,
        cenfit(TEC, LR, group)
        )



#method 1
out <- with(new.ex, cenfit(TEC, LR, group))
res <- as.data.frame(do.call(rbind, mean(out) ))
res$n <- out at survfit$n       # see str(out) to discover why
res$sum <- with(res, n * mean)
res


#method 2
library(plyr)
res2 <- ldply(mean(out), rbind)
names(res2)[-1] <- names(mean(out)[[1]])
res2 <- mutate(res2, n = out at survfit$n, sum = mean * n)
res2







--
View this message in context: http://r.789695.n4.nabble.com/function-customization-tp4649711p4650041.html
Sent from the R help mailing list archive at Nabble.com.