Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gg_check

Spell check ggplot2 plot labels


Description

Due to the way ggplot2 objects are created, this has to be used in a standalone context.

Usage

gg_check(gg, dict, ignore)

Arguments

gg

ggplot2 object

dict

a dictionary object or string which can be passed to hunspell::dictionary. Defaults to hunspell::dictionary("en_US")

ignore

character vector with additional approved words added to the dictionary. Defaults to hunspell::en_stats

Details

Current functionality only looks for misspelled words in the labels of ggplot2 objects. When misspelled words are found, a message is printed with the words and the label that they are in. No messages will be printed if there are no misspelled words.

Value

the object that was passed in

Examples

library(ggplot2)

df <- data.frame(x=c(20, 25, 30), y=c(4, 4, 4), txt=c("One", "Two", "Three"))

# not piping
ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="This is some txt", y="This is more text",
       title="Thisy is a titlle",
       subtitle="This is a subtitley",
       caption="This is a captien") -> gg

gg_check(gg)

hrbrthemes

Additional Themes, Theme Components and Utilities for 'ggplot2'

v0.8.0
MIT + file LICENSE
Authors
Bob Rudis [aut, cre] (<https://orcid.org/0000-0001-5670-2640>), Patrick Kennedy [ctb], Philipp Reiner [ctb], Dan Wilson [ctb] (Secondary axis support), Xavier Adam [ctb], Google [cph] (Roboto Condensed & Titillium Web Fonts), IBM [cph] (Plex Sans Font), Impallari Type [cph] (Public Sans Font), Jacob Barnett [ctb], Thomas J. Leeper [ctb] (<https://orcid.org/0000-0003-4097-6326>), Joris Meys [ctb]
Initial release
2020-03-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.