From 14b5f9bb462cee9ea8c1bd9268973e1911a09846 Mon Sep 17 00:00:00 2001 From: Bob Rudis Date: Wed, 31 May 2017 16:30:34 -0400 Subject: [PATCH] Fixes #20 (and actually gets rid of purrr unlike the last commit) --- DESCRIPTION | 2 +- R/check.r | 17 +++++++++-------- hrbrthemes.Rproj | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d5cda47..a676df9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: hrbrthemes Type: Package Title: Additional Themes, Theme Components and Utilities for 'ggplot2' -Version: 0.3.0 +Version: 0.3.1 Date: 2017-03-01 Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")), diff --git a/R/check.r b/R/check.r index 2bf19f5..d47355c 100644 --- a/R/check.r +++ b/R/check.r @@ -50,14 +50,15 @@ gg_check <- function(gg, dict, ignore) { tmp <- lapply(names(lbl), function(lab) { - words <- stringi::stri_extract_all_words(lbl[[lab]]) - words <- unlist(words) - words <- purrr::discard(hunspell::hunspell(words, "text", dict = dict, ignore = ignore), - ~length(.)==0) - - if (length(words) > 0) { - message(sprintf("Possible misspelled words in [%s]: (%s)", - lab, paste0(words, collapse=", "))) + if (length(lbl[[lab]]) > 0) { + words <- stringi::stri_extract_all_words(lbl[[lab]]) + words <- unlist(words) + w_tmp <- hunspell::hunspell(words, "text", dict = dict, ignore = ignore) + words <- w_tmp[which(sapply(w_tmp, length) > 0)] + if (length(words) > 0) { + message(sprintf("Possible misspelled words in [%s]: (%s)", + lab, paste0(words, collapse=", "))) + } } }) diff --git a/hrbrthemes.Rproj b/hrbrthemes.Rproj index 446d9e1..aecf8cb 100644 --- a/hrbrthemes.Rproj +++ b/hrbrthemes.Rproj @@ -3,6 +3,7 @@ Version: 1.0 RestoreWorkspace: Default SaveWorkspace: Default AlwaysSaveHistory: Default +QuitChildProcessesOnExit: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes