dist2Centers <- function(x,centers){
min(unlist(sapply(seq_len(nrow(centers)), function(rw){sum((x-centers[rw,])^2)})))
} #end dist2Centers
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.