tests/testthat/test-counts.R

library(testthat)
library(Kmisc)

table_ <- function(x) {
  tmp <- table(x)
  out <- as.integer(tmp)
  names(out) <- dimnames(tmp)[[1]]
  return(out)
}

set.seed(123)
x <- round( rnorm(1E4), 0 )
y <- as.integer(x)
expect_identical( counts(x), table_(x) )

Try the Kmisc package in your browser

Any scripts or data that you put into this service are public.

Kmisc documentation built on May 29, 2017, 1:43 p.m.