#######################
### affectIndiv
### Some trajectories
traj <- gald3d()["traj"]
### 4 clusters centers
center <- traj[runif(4,1,nrow(traj)),,]
### Affectation of each individual
part <- affectIndiv3d(traj,center)
#################
### K-means simulation (4 steps)
plot(clusterLongData3d(traj),partition(part))
for (i in 1:4){
center <- calculTrajMean3d(traj,part)
part <- affectIndiv3d(traj,center)
plot(clusterLongData3d(traj),partition(part))
}
Run the code above in your browser using DataLab