# simulated data
clustering1 <- c(rep(1, 5), rep(2, 10), rep(3, 10))
clustering2 <- c(rep(1, 6), rep(2, 6), rep(3, 4), rep(4, 9))
weights <- table(clustering1, clustering2)
barycentre(weights[1, ], 1:4)
barycentre(weights[1, ])
barycentre(weights[2, ], 1:4)
apply(weights, 1, barycentre, 1:4)
Run the code above in your browser using DataLab