knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

ggois

The goal of ggois is to make plots for in O&S style.

Installation

You can install ggois from github with:

# install.packages("devtools")
devtools::install_github("brilstl/ggois")

Example

This is a basic example of a plot with the theme_ois() function:

library(ggois)
library(tidyverse)

# plot ----

diamonds %>% 
  ggplot(
  aes(x = price,
      y = cut)) +
  geom_boxplot(colour = os_colours$red) +
  theme_ois()

ggois also has some convenient functions for making tables and plots. The package is designed in a (generalized) linear algebra fashion (y ~ x). This means that every functions includes the paramters data, y and x. Some functions also allow for a moderator (y ~ x*z). The packages has functions such as ggois_bar_chart and ggois_likert_chart, which create a summary tibble. The summary tibble inherits a class, by which the functions autoplot and autotable know how to interpret the data for plotting and creating tables. See examples below:

bar plot

example_bar <- diamonds %>% 
  ggois_bar_chart(cut, price)


example_bar

plot

example_bar %>% 
  autoplot()

table

example_bar %>% 
  autotable() %>% 
  gt::as_raw_html()

likert plot

example_likert <- diamonds %>% 
  ggois_likert_chart(cut, clarity)


example_likert

plot

example_likert %>% 
  autoplot()

table

example_likert %>% 
  autotable() %>% 
  gt::as_raw_html()

likert plot with moderator

example_likert <- diamonds %>% 
  filter(color %in% c("D", "E", "F")) %>% 
  ggois_likert_chart(cut, clarity, color)


example_likert

plot

example_likert %>% 
  autoplot()

table

example_likert %>% 
  autotable() %>% 
  gt::as_raw_html()

changing colors

example_likert %>% 
  autoplot(palette = c(os_colours$pink, "white", os_colours$red))


brilstl/ggois documentation built on May 4, 2022, 5:44 p.m.