# Basic usage
printif(42, show = TRUE)
printif(42, show = FALSE)
# Using numeric shortcuts
printif("Hello", 1)
printif("Hello", 0)
# Most useful usage : in a pipeline (requires dplyr)
if (requireNamespace("dplyr", quietly = TRUE)) {
library(dplyr)
mtcars %>%
filter(mpg > 20) %>%
summarise(mean_hp = mean(hp)) %>%
printif(1)
}
Run the code above in your browser using DataLab