https://github.com/ctlab/phantasus
Raw File
Tip revision: 0c033b47255ebef5d3e17b1a3b4dee9a8abe6387 authored by Alexey Sergushichev on 27 February 2018, 15:55:49 UTC
js tests doesn't work on appveyor :(
Tip revision: 0c033b4
testkmeans.R
context("Kmeans")
library(jsonlite)

test_that("kmeans finishes with result", {
  load(file = system.file("testdata/GSE27112-GPL6103.rda", package="phantasus"))
  expect_is(performKmeans(es, k = 10), "json")
})

test_that("kmeans works with datasets with lots of NAs", {
  es <- read.gct(system.file("testdata/centers.gct", package="phantasus"))
  expect_length(fromJSON(performKmeans(es, k = 2)), nrow(es))
})

test_that("kmeans returns only vector for a subset", {
    es <- read.gct(system.file("testdata/centers.gct", package="phantasus"))
    rows <- c(0, 2, 3, 5)
    expect_length(fromJSON(performKmeans(es, rows=rows, k = 2)), length(rows))
})
back to top