Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. # GG_heatmap --------------------------------------------------------------
  2.  
  3. #save plots to list
  4. heatmaps = list(
  5. #various options
  6. default = mtcars[, c(1,3,4,5,6,7)] %>% GG_heatmap(),
  7. no_reorder = mtcars[, c(1,3,4,5,6,7)] %>% GG_heatmap(reorder_vars = F),
  8. no_values = mtcars[, c(1,3,4,5,6,7)] %>% GG_heatmap(add_values = F),
  9. many_digits = mtcars[, c(1,3,4,5,6,7)] %>% GG_heatmap(digits = 5)
  10. )
  11.  
  12. test_that("GG_heatmap", {
  13. #check that plots work
  14. walk(heatmaps, ~expect_s3_class(., class = "ggplot"))
  15.  
  16. #check for non-identity
  17. #cant think of an easy smart way to do this
  18. expect_true(!identical(heatmaps$default, heatmaps$no_reorder))
  19. expect_true(!identical(heatmaps$default, heatmaps$no_values))
  20. expect_true(!identical(heatmaps$default, heatmaps$many_digits))
  21. expect_true(!identical(heatmaps$no_reorder, heatmaps$no_values))
  22. expect_true(!identical(heatmaps$no_reorder, heatmaps$many_digits))
  23. expect_true(!identical(heatmaps$no_values, heatmaps$many_digits))
  24. })
  25.  
  26. > gtools::combinations(4, 2)
  27. [,1] [,2]
  28. [1,] 1 2
  29. [2,] 1 3
  30. [3,] 1 4
  31. [4,] 2 3
  32. [5,] 2 4
  33. [6,] 3 4
  34.  
  35. expect_true(!identical(heatmaps[[v1]], heatmaps[[v2]]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement