[SPARK-13472] [SPARKR] Fix unstable Kmeans test in R

JIRA: https://issues.apache.org/jira/browse/SPARK-13472

## What changes were proposed in this pull request?

One Kmeans test in R is unstable and sometimes fails. We should fix it.

## How was this patch tested?

Unit test is modified in this PR.

Author: Liang-Chi Hsieh <viirya@gmail.com>

Closes #11345 from viirya/fix-kmeans-r-test and squashes the following commits:

f959f61 [Liang-Chi Hsieh] Sort resulted clusters.
This commit is contained in:
Liang-Chi Hsieh 2016-02-24 07:05:20 -08:00 committed by Xiangrui Meng
parent bcfd55fa98
commit 8930181833

View file

@ -130,7 +130,7 @@ test_that("kmeans", {
# Test stats::kmeans is working
statsModel <- kmeans(x = newIris, centers = 2)
expect_equal(unique(statsModel$cluster), c(1, 2))
expect_equal(sort(unique(statsModel$cluster)), c(1, 2))
# Test fitted works on KMeans
fitted.model <- fitted(model)