context("colwise distinct")
test_that("scoped distinct is identical to manual distinct", {
df <- data_frame(
x = rep(2:5, each=2),
y = rep(2:3, each = 4),
z = "a"
)
expect_identical(distinct_all(df), distinct(df, x, y, z))
expect_identical(distinct_at(df, vars(x)), distinct(df, x))
expect_identical(distinct_if(df, is.integer), distinct(df, x, y))
})
test_that(".funs is applied to variables before getting distinct rows", {
df <- data_frame(
x = rep(2:5, each=2),
y = rep(2:3, each = 4)
)
expect_identical(distinct_all(df, `-`), distinct(mutate_all(df,`-`), x, y))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.