Nothing
context("Regular expression translations")
test_that("grepl() returns expected result", {
check_impala()
test_op <- function(x) {
x %>%
filter(grepl("^v", species)) %>%
tally() %>%
collect() %>%
as.integer()
}
expect_true(
compare(test_op(tbl(impala, "iris")), 100L)
)
})
test_that("grepl() ignores case by default and returns expected result", {
check_impala()
test_op <- function(x) {
x %>%
filter(grepl("^V", species)) %>%
tally() %>%
collect() %>%
pull(1) %>%
as.integer()
}
expect_true(
compare(test_op(tbl(impala, "iris")), 0L)
)
})
test_that("grepl() returns expected result with ignore.case = TRUE", {
check_impala()
test_op <- function(x) {
x %>%
filter(grepl("^V", species, ignore.case = TRUE)) %>%
tally() %>%
collect() %>%
pull(1) %>%
as.integer()
}
expect_true(
compare(test_op(tbl(impala, "iris")), 100L)
)
})
test_that("gsub() returns expected result", {
check_impala()
test_op <- function(x) {
x %>%
transmute(mangled = gsub("v", "b", species)) %>%
distinct(mangled) %>%
arrange(desc(mangled)) %>%
collect() %>%
pull(1)
}
expect_true(
compare(test_op(tbl(impala, "iris")), c("setosa", "birginica", "bersicolor"))
)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.