inst/tinytest/test_degenerate_project.R

test_good_project <- function() {
  d <- data.frame(x = 1:4,
                  y = c('a', 'a', 'b', 'b'),
                  stringsAsFactors = FALSE)
  ops <- project(local_td(d), x2 := max(x))
  d %.>% ops
  invisible(NULL)
}

test_good_project()



test_degenerate_project <- function() {
  d <- data.frame(x = 1:4,
                  y = c('a', 'a', 'b', 'b'),
                  stringsAsFactors = FALSE)
  expect_error({
    ops <- project(local_td(d), x2 := x)  # rquery may thow here
    d %.>% ops
  })
  invisible(NULL)
}

test_degenerate_project()



test_project_calc <- function() {
  d <- data.frame(x = 1:4,
                  y = c('a', 'a', 'b', 'b'),
                  stringsAsFactors = FALSE)
  ops <- project(local_td(d), x2 := max(x) + max(x))
  d %.>% ops
  invisible(NULL)
}

test_project_calc()

Try the rqdatatable package in your browser

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

rqdatatable documentation built on Aug. 21, 2023, 9:10 a.m.