Skip to content
Back to formatted view

Raw Message

Message-ID: <1352993453001-4649613.post@n4.nabble.com>
Date: 2012-11-15T15:30:53Z
From: Massimo Bressan
Subject: How to modify a S4 function (in the package NADA)
In-Reply-To: <CAM_vjum2mCGAWwX9_c4OoV0v4LG2yO_Yne74L2oPD6=YP4-rMQ@mail.gmail.com>

Ok, this is my finally (hopefully) clean session

my.ex<-structure(list(TEC = c(0.21, 0.077, 0.06, 0.033, 0.014, 0.0072), LR =
c(FALSE, FALSE, TRUE, FALSE, TRUE, FALSE)), .Names = c("TEC","LR"),
row.names = c(NA, -6L), class = "data.frame")

library("NADA")

xx<-with(my.ex,
         cenfit(TEC,LR)
        )

xx

mycenfit <- function(x) {
  s = summary(x)
  c(n = nrow(s), n.cen = nrow(s) - sum(s$n.event), median = median(x),
    mean = mean(x)[["mean"]], sd = sd(x), sum=mean(x)[["mean"]]*length(x))
}

mycenfit(xx)


thank you so much for your help
(I still have much to fully understand S4 methods, R objects and functions)

max



--
View this message in context: http://r.789695.n4.nabble.com/How-to-modify-a-S4-function-in-the-package-NADA-tp4649586p4649613.html
Sent from the R help mailing list archive at Nabble.com.