Learn R Programming

latrend (version 1.1.0)

subset.lcModels: Subsetting a lcModels list based on method arguments

Description

Subsetting a lcModels list based on method arguments

Usage

# S3 method for lcModels
subset(x, subset, drop = FALSE, ...)

Arguments

x

The lcModels or list of lcModel to be subsetted.

subset

Logical expression based on the lcModel method arguments, indicating which lcModel objects to keep.

drop

Whether to return a lcModel object if the result is length 1.

...

Not used.

Value

A lcModels list with the subset of lcModel objects.

See Also

Other lcModel list functions: as.lcModels(), lcModels, print.lcModels()

Examples

Run this code
# NOT RUN {
data(latrendData)
mKML <- lcMethodKML(response = "Y", id = "Id", time = "Time")
kml1 <- latrend(mKML, nClusters = 1, latrendData)
kml2 <- latrend(mKML, nClusters = 2, latrendData)
kml3 <- latrend(mKML, nClusters = 3, latrendData)
gmm <- latrend(lcMethodLcmmGMM(fixed = Y ~ Time, mixture = ~ Time,
   id = "Id", time = "Time"), latrendData)
models <- lcModels(kml1, kml2, kml3, gmm)

subset(models, nClusters > 1 & .method == 'kml')
# }

Run the code above in your browser using DataLab