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

library(reohelpers)
library(ggplot2)
library(dplyr)
library(readr)

reohelpers

The goal of reohelpers is to make te reo easier to use in R.

Installation

reohelpers is not yet released on CRAN but you can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("joevalalipin/reohelpers")

Overview

Examples

add_macron()

Usually the data comes without macron accents

infringements <- read_csv("data/infringements.csv")
infringements %>% 
  ggplot(aes(x = `Infringement notices`, y = reorder(Council, -`Infringement notices`))) +
  geom_col() +
  labs(title = "Number of infringement notices issued by councils\nin 2018-19",
       x = "",
       y = "",
       caption = "Putake: Manatu Mo Te Taiao") +
  scale_x_continuous(expand = c(0, 0)) +
  theme_classic()

Using the function would add appropriate macrons to place names and words

infringements %>% 
  mutate(Council = add_macron(Council)) %>% 
  ggplot(aes(x = `Infringement notices`, y = reorder(Council, -`Infringement notices`))) +
  geom_col() +
  labs(title = "Number of infringement notices issued by councils\nin 2018-19",
       x = "",
       y = "",
       caption = paste0(add_macron("Putake"), ": Ministry for the Environment")) +
  scale_x_continuous(expand = c(0, 0)) +
  theme_classic()

macron_vowel()

If for any reason you need to add macron to a specific character in a string use macron_vowel(): r macron_vowel("a e i o u")

meaning()

A quick way to get the meaning of te reo words.

meaning("reo")

Not advised for phrases but it gives you the idea.

meaning("kia ora")


joevalalipin/reohelpers documentation built on Dec. 21, 2021, 1:19 a.m.