if(require('fpc')) {
with(mtcars, sep_dist(data.frame(wt, mpg, as.numeric(as.factor(mtcars$cyl))),
data.frame(sample(wt), mpg, as.numeric(as.factor(mtcars$cyl))),
clustering = TRUE))
}
if (require('fpc')) {
with(mtcars, sep_dist(data.frame(wt, mpg, as.numeric(as.factor(mtcars$cyl))),
data.frame(sample(wt), mpg, as.numeric(as.factor(mtcars$cyl))),
nclust = 3))
}
Run the code above in your browser using DataLab