Learn R Programming

kml (version 2.1.2)

ClusterLongData-class: ~ Class: ClusterLongData ~

Description

ClusterLongData is an object containing trajectories and associated Partition

Arguments

Objects from the Class

kml is an algorithm that builds a set of Partition from longitudinal data. ClusterLongData is the object containing the original longitudinal data and all the Partition that kml finds. When created, an ClusterLongData object simply contains initial data (the trajectories). After the execution of kml, it contains the original data and the Partition which has just been calculated by kml. Note that if kml is executed several times, every new Partition is added to the original ones, no pre-existing Partition is erased.

Extends

Class LongData, directly. Class ListPartition, directly.

Construction

Class ClusterizLongData objects can be constructed via function clusterLongData that turn a data.frame or a matrix into a ClusterLongData. Note that some artificial data can be generated using gald.

See Also

Overview: kml-package Classes : Partition, LongData, ListPartition Methods : clusterLongData, kml, choice Plot : plot(ClusterLongData), plotCriterion

Examples

Run this code
################
### Creation of some trajectories

traj <- matrix(c(1,2,3,1,4, 3,6,1,8,10, 1,2,1,3,2, 4,2,5,6,3, 4,3,4,4,4, 7,6,5,5,4),6)

myCld <- clusterLongData(
    traj=traj,
    idAll=as.character(c(100,102,103,109,115,123)),
    time=c(1,2,4,8,15),
    varNames="P",
    maxNA=3
)

################
### get and set
myCld["idAll"]
myCld["varNames"]
myCld["traj"]

################
### Creation of a Partition
part2 <- partition(clusters=rep(1:2,3),myCld)
part3 <- partition(clusters=rep(1:3,2),myCld)


################
### Adding a clusterization to a clusterizLongData
myCld["add"] <- part2
myCld["add"] <- part3
myCld

Run the code above in your browser using DataLab