Get the number of clusters estimated by the given object.

nClusters(object, ...)

# S4 method for lcModel
nClusters(object, ...)

Arguments

object

The object

...

Not used.

Value

The number of clusters: a scalar numeric non-zero count.

Examples

data(latrendData)
method <- lcMethodRandom("Y", id = "Id", time = "Time", nClusters = 3)
model <- latrend(method, latrendData)
nClusters(model) # 3
#> Error in (function (classes, fdef, mtable) {    methods <- .findInheritedMethods(classes, fdef, mtable)    if (length(methods) == 1L)         return(methods[[1L]])    else if (length(methods) == 0L) {        cnames <- paste0("\"", vapply(classes, as.character,             ""), "\"", collapse = ", ")        stop(gettextf("unable to find an inherited method for function %s for signature %s",             sQuote(fdef@generic), sQuote(cnames)), domain = NA)    }    else stop("Internal error in finding inherited methods; didn't return a unique method",         domain = NA)})(list(structure("lcModelPartition", package = "latrend")),     new("standardGeneric", .Data = function (object, ...)     standardGeneric("nClusters"), generic = structure("nClusters", package = "clValid"),         package = "clValid", group = list(), valueClass = character(0),         signature = "object", default = NULL, skeleton = (function (object,             ...)         stop(gettextf("invalid call in method dispatch to '%s' (no default method)",             "nClusters"), domain = NA))(object, ...)), <environment>): unable to find an inherited method for function ‘nClusters’ for signature ‘"lcModelPartition"’