tests/testthat/test_nonsyntactic.R

library(testthat)
if(require(ggplot2)){
  test_that("Nonsyntactic variable names are accepted", {
    mpg2 <- within(mpg, `car class` <- class)
    gg <- ggplot(mpg2, aes(hwy, cty, colour=`car class`)) +
      geom_point()
    p <- directlabels::direct.label(gg)
    expect_is(p, "ggplot")
  })
}
tdhock/directlabels documentation built on April 21, 2024, 11:32 a.m.