Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (31 sloc) 2.89 KB
title: "`gramr`: The grammar of grammar"
author: 'Jasmine Dumas ('
date: '2017-05-26'
html_document: default
md_document: default
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
**Package Developers**: Jasmine Dumas (, Ben Marwick (, Gordon Shotwell (
The idea behind this package was to develop a tool that checks for common grammatical errors as a companion to the native RStudio spell check, posed in the [ropensci/unconf issue #53]( The initial problem statement was to alleviate some of the time consuming efforts in grammar-checking R Markdown documents in external word processing tools such as MS word or Google Docs. A tool that gives feedback on common writing problems will help R Markdown authors because they wont need to interrupte their workflow by leaving RStudio to get this feedback.
**Key steps in the development of the package included**:
1. Identifying a suitable existing package for checking writing for catching common writing problems. Various good options exist, and we settled on [`write-good`]( because it is a popular project on GitHub.
2. Bundling the `write-good` program for stand-alone use in an R package was challenging. We relied on the [vignettes for the V8 package](, which was a huge help for getting started. But we found that we needed to modify these instructions to correctly bundle the program. Trial and error eventually got us through.
3. Writing functions to collect and prepare the text for the `write-good` functions was a minor challenge. A few cryptic errors required further trial and error to solve. We added code tests to ensure that we'd nailed these problems.
4. A `shiny` application was developed to guide the correction of grammatical mistakes.
Future directions include tidying and prettying the output so that it's more intuitive and easier to understand.
**The package can be used in three ways**:
1. When writing an Rmd in RStudio, you can use the RStudio Addin `write-good` to check the active Rmd document.
2. From the R console or a terminal, you can use `gramr::write_good_file("my_document.Rmd")` to run the checks on any Rmd file. This means you can use the functions without RStudio.
3. A shiny application can be launched with `gramr::run_grammar_checker("example.rmd")`
We collaborated on package development through the [#gramr GitHub repository issue tracker]( and a dedicated Slack channel in the rOpenSci Slack org.
**Example Usage**:
# when the library is loaded it checks that the write-good javascript bundle is available
# assuming we are in the top level of the pkg repo