Skip to content
Prev 311256 / 398506 Next

function customization

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.