# small function to display plots only if it's interactive
p_ <- GGally::print_if_interactive
data(tips)
p_(ggtable(tips, "smoker", c("day", "time", "sex")))
# displaying row proportions
p_(ggtable(tips, "smoker", c("day", "time", "sex"), cells = "row.prop"))
# filling cells with standardized residuals
p_(ggtable(tips, "smoker", c("day", "time", "sex"), fill = "std.resid", legend = 1))
# if continuous variables are provided, just displaying some summary statistics
p_(ggtable(tips, c("smoker", "total_bill"), c("day", "time", "sex", "tip")))
# specifying weights
d <- as.data.frame(Titanic)
p_(ggtable(
d,
"Survived",
c("Class", "Sex", "Age"),
mapping = aes(weight = Freq),
cells = "row.prop",
fill = "std.resid"
))
Run the code above in your browser using DataLab