Get the number of clusters estimated by the given object.
nClusters(object, ...)
# S4 method for lcModel
nClusters(object, ...)
The object
Not used.
The number of clusters: a scalar numeric
non-zero count.
Other lcModel functions:
clusterNames()
,
clusterProportions()
,
clusterSizes()
,
clusterTrajectories()
,
coef.lcModel()
,
converged()
,
deviance.lcModel()
,
df.residual.lcModel()
,
estimationTime()
,
externalMetric()
,
fitted.lcModel()
,
fittedTrajectories()
,
getCall.lcModel()
,
getLcMethod()
,
ids()
,
lcModel-class
,
metric()
,
model.frame.lcModel()
,
nIds()
,
nobs.lcModel()
,
plot-lcModel-method
,
plotClusterTrajectories()
,
plotFittedTrajectories()
,
postprob()
,
predict.lcModel()
,
predictAssignments()
,
predictForCluster()
,
predictPostprob()
,
qqPlot()
,
residuals.lcModel()
,
sigma.lcModel()
,
strip()
,
time.lcModel()
,
trajectoryAssignments()
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"’