sorry sarah you are right, my fault, this is the correct reproducible example (a misinterpretation of LR type occurred in previous reproducible example)
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") but, nevertheless, still some problems exists because... str(my.ex) library(NADA) with(my.ex, cenfit(TEC,LR) ) mycenfit <- function(x, y) { result <- cenfit(x, y) c(result, sum = result$n * result$mean) } with(my.ex, mycenfit(TEC,LR) ) giving me the following error message Error in result$n : $ operator not defined for this S4 class again pointing to the peculiar structure of S4 class (at least I think to understand) thank you for your reply max -- View this message in context: http://r.789695.n4.nabble.com/How-to-modify-a-S4-function-in-the-package-NADA-tp4649586p4649598.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.