File: test-qplot.r

package info (click to toggle)
r-cran-ggplot2 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,412 kB
  • sloc: sh: 9; makefile: 1
file content (27 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
context("qplot")

test_that("qplot works with variables in data frame and parent env", {
  df <- data.frame(x = 1:10, a = 1:10)
  y <- 1:10
  b <- 1:10

  expect_is(qplot(x, y, data = df), "ggplot")
  expect_is(qplot(x, y, data = df, colour = a), "ggplot")
  expect_is(qplot(x, y, data = df, colour = b), "ggplot")

  bin <- 1
  expect_is(qplot(x, data = df, binwidth = bin), "ggplot")
})

test_that("qplot works in non-standard environments", {
  env <- new.env(parent = globalenv())
  expr <- quote({
    `-1-` <- 10
    x <- 1:10
    qplot(x, breaks = 0:`-1-`)
  })

  expect_is(eval(expr, env), "ggplot")

})