tests/testthat/test-roxytest-testexamples-show_group_distribution.R

# Generated by roxytest: do not edit by hand!

# File R/show_group_distribution.R: @testexamples

test_that("Function show_group_distribution() @ L61", {
  
  
  set.seed(1234)
  data <- data.frame(
    yval = rnorm(120),
    gr = c(rep("A", 50), rep("B", 40), rep("C", 30))
  )
  p <- show_group_distribution(data,
    gvar = 2, dvar = 1,
    g_label = "norm",
    background_color = "grey"
  )
  p
  p2 <- show_group_distribution(data,
    gvar = "gr", dvar = "yval",
    g_position = "bottom",
    order_by_fun = TRUE,
    alpha = 0.3
  )
  p2
  
  # Set custom group names
  p3 <- show_group_distribution(data,
    gvar = 2, dvar = 1,
    g_label = c("A" = "X", "B" = "Y", "C" = "Z")
  )
  p3
  
  expect_is(p, "ggplot")
  expect_is(p2, "ggplot")
  expect_is(p3, "ggplot")
})
ShixiangWang/sigminer documentation built on March 16, 2024, 12:30 p.m.