[R] How to modify a S4 function (in the package NADA)

maxbre mbressan at arpa.veneto.it
Thu Nov 15 16:30:53 CET 2012


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.




More information about the R-help mailing list