tests/testthat/test-stack_list.R

library(Kmisc)
library(testthat)

dat <- vector("list", 10)
for( i in 1:10 ) { 
  dat[[i]] <- data.frame( x=rnorm(10), y=sample(letters, 10), z=sample(LETTERS,10) ) 
}

unrowname <- function(x) {
  rownames(x) <- 1:nrow(x)
  return(x)
}

expect_identical( 
  stack_list(dat)[,1:length(dat[[1]])], 
  factor_to_char( unrowname( do.call( rbind, dat ) ) ) 
)

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.