disp_hist_base <- function() hist(mtcars$disp)
expect_doppelganger("disp-histogram-base", disp_hist_base)
if (requireNamespace("ggplot2", quietly = TRUE)) {
library("ggplot2")
disp_hist_ggplot <- ggplot(mtcars, aes(disp)) + geom_histogram()
expect_doppelganger("disp-histogram-ggplot", disp_hist_ggplot)
}
Run the code above in your browser using DataCamp Workspace