knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

EMK

EMK is a collection of miscellaneous functions I have written that I personally find helpful in a variety of contexts.

Installation

You can install EMK from github with:

# install.packages("devtools")
devtools::install_github("EllaKaye/EMK")
library(EMK)

n_letter_words

n_letter_words is a function that will produce all 'words' of n letters long. Its usage is n_letter_words(n, num_letters = 26, case = c("upper", "lower"), as_vector = FALSE).

n_letter_words(3)
three_vec <- n_letter_words(3, as_vector = TRUE)
c(head(three_vec), tail(three_vec))
n_letter_words(5, num_letters = 2, case = "lower")

ggpres

Typically, if you have a plot designed to look good in print or on the web, when it is included in a presentation, the text on the title, axes, legend and facet strips is too small to be read by everyone in the room. ggpres fixes that by taking a ggplot plot and increasing the size of the text. Usage is ggpres(g, title_size = 24, text_size = 18). ggpres only deals with text size, and further adjustments to the plot may still be necessary to make it appropriate for a presentation, such as increasing point size or line width. Thanksfully, the modular nature of ggplot makes it easy to make such adjustments after passing the plot through ggpres.

library(ggplot2)
g <- ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  facet_wrap(~class, scales = "free") + 
   ggtitle("A faceted plot")
g
ggpres(g, text_size = 15) +
  geom_point(size = 2)


EllaKaye/EMK documentation built on Jan. 7, 2023, 3:24 p.m.