https://github.com/cran/simecol
Tip revision: 27972f79606ed158414d982ce17b7f8dbe5bb6e9 authored by Thomas Petzoldt on 07 October 2021, 05:40:02 UTC
version 0.8-14
version 0.8-14
Tip revision: 27972f7
modelFit.R
############################################################
# S4 class and methods for model fits #
############################################################
setClass("modelFit",
representation(
par = "numeric",
message = "ANY",
value = "ANY",
list = "ANY"
))
setMethod("coef", "modelFit",
function(object, ...) {
object@par
}
)
setMethod("deviance", "modelFit",
function(object, ...) {
object@value
}
)
setMethod("summary", "modelFit",
function(object, ...) {
cat("Model parameters", object@par, "\n")
cat("Deviance:", object@deviance, "\n")
cat("Message:", object@message, "\n")
})
## accessor methods for S3 compatibility (read-only)
setMethod("$", "modelFit",
function(x, name)
{
## 'name' is a character(1)
slot(x, name)
})
setMethod("[", "modelFit",
function(x, i, j, ..., drop=TRUE)
{
x@list[i, j, ..., drop=drop]
})
setMethod("[[", "modelFit",
function(x, i, j, ...)
{
x@list[[i, j, ...]]
})