context("test-weigted.R")
test_that("test of frequency method", {
expect_equal(flag_weighted(1, data.frame(f=c("pe","b","p","p","u","e","d"),stringsAsFactors = F), data.frame(w=c(10,3,7,12,31,9,54))),c("d","54"))
expect_equal(flag_weighted(1, data.frame(f=c("pe","b","p","p","up","e","d"),stringsAsFactors = F), data.frame(w=c(10,3,7,12,31,9,54))),c("p","60"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,NA,NA,NA),stringsAsFactors = F), data.frame(w=c(NA,NA,NA,NA))),c(NA,NA))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"b",NA,NA),stringsAsFactors = F), data.frame(w=c(NA,NA,NA,NA))),c(NA,NA))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"b",NA,"b"),stringsAsFactors = F), data.frame(w=c(NA,NA,NA,8))),c("b","8"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bd",NA,NA),stringsAsFactors = F), data.frame(w=c(NA,9,NA,7))),c("b, d","9"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bd",NA,"be"),stringsAsFactors = F), data.frame(w=c(NA,9,NA,7))),c("b","16"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bde",NA,NA),stringsAsFactors = F), data.frame(w=c(NA,10,NA,7))),c("b, d, e","10"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bd",NA,"d"),stringsAsFactors = F), data.frame(w=c(NA,9,NA,7))),c("d","16"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bde","deu","peb"),stringsAsFactors = F), data.frame(w=c(NA,9,5,7))),c("e","21"))
expect_equal(flag_weighted(1, data.frame(f=c(NA,"bde","deu","peb"),stringsAsFactors = F), data.frame(w=c(NA,9,5,NA))),c("d, e","14"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.