Skip to content

Commit

Permalink
edit blog and function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jasdumas committed May 26, 2017
1 parent 4439c60 commit 6a97850
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

^BLOG\.Rmd$
^BLOG\.html$
^example\.rmd$
18 changes: 9 additions & 9 deletions BLOG.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ knitr::opts_chunk$set(echo = TRUE)

**Package Developers**: Jasmine Dumas ([email protected], Ben Marwick ([email protected]), Gordon Shotwell ([email protected])

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](https://github.com/ropensci/unconf17/issues/53). The initial problem statement was to alleviate some of the the time consuming efforts in grammar-checking R Markdown documents in external word processing tools such as MS word or Google sheets. 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.
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](https://github.com/ropensci/unconf17/issues/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:
**Key steps in the development of the package included**:

1. Identifying a suitable existing package for checking writing for catching common writing problems. Many good options exist, and we settled on [`write-good`](https://github.com/btford/write-good) because it is a popular project on GitHub.
1. Identifying a suitable existing package for checking writing for catching common writing problems. Various good options exist, and we settled on [`write-good`](https://github.com/btford/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](https://cran.r-project.org/web/packages/V8/vignettes/npm.html), 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. [something on the Shiny app from GS]
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.
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:
**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. [something on the Shiny app from GS]
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](https://github.com/ropenscilabs/gramr/issues) and a dedicated Slack channel in the rOpenSci Slack org.
We collaborated on package development through the [#gramr GitHub repository issue tracker](https://github.com/ropenscilabs/gramr/issues) and a dedicated Slack channel in the rOpenSci Slack org.

### Example Usage
**Example Usage**:

```{r}
# when the library is loaded it checks that the write-good javascript bundle is available
Expand Down
18 changes: 8 additions & 10 deletions BLOG.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,23 @@ <h4 class="date"><em>2017-05-26</em></h4>


<p><strong>Package Developers</strong>: Jasmine Dumas (<a href="mailto:[email protected]">[email protected]</a>, Ben Marwick (<a href="mailto:[email protected]">[email protected]</a>), Gordon Shotwell (<a href="mailto:[email protected]">[email protected]</a>)</p>
<p>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 <a href="https://github.com/ropensci/unconf17/issues/53">ropensci/unconf issue #53</a>. The initial problem statement was to alleviate some of the the time consuming efforts in grammar-checking R Markdown documents in external word processing tools such as MS word or Google sheets. 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.</p>
<p>Key steps in the development of the package included:</p>
<p>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 <a href="https://github.com/ropensci/unconf17/issues/53">ropensci/unconf issue #53</a>. 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.</p>
<p><strong>Key steps in the development of the package included</strong>:</p>
<ol style="list-style-type: decimal">
<li>Identifying a suitable existing package for checking writing for catching common writing problems. Many good options exist, and we settled on <a href="https://github.com/btford/write-good"><code>write-good</code></a> because it is a popular project on GitHub.</li>
<li>Identifying a suitable existing package for checking writing for catching common writing problems. Various good options exist, and we settled on <a href="https://github.com/btford/write-good"><code>write-good</code></a> because it is a popular project on GitHub.</li>
<li>Bundling the <code>write-good</code> program for stand-alone use in an R package was challenging. We relied on the <a href="https://cran.r-project.org/web/packages/V8/vignettes/npm.html">vignettes for the V8 package</a>, 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.</li>
<li>Writing functions to collect and prepare the text for the <code>write-good</code> 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.</li>
<li>[something on the Shiny app from GS]</li>
<li>A <code>shiny</code> application was developed to guide the correction of grammatical mistakes.</li>
</ol>
<p>Future directions include tidying and prettying the output so that it’s more intuitive and easier to understand.</p>
<p>The package can be used in three ways:</p>
<p><strong>The package can be used in three ways</strong>:</p>
<ol style="list-style-type: decimal">
<li>When writing an Rmd in RStudio, you can use the RStudio Addin <code>write-good</code> to check the active Rmd document.</li>
<li>From the R console or a terminal, you can use <code>gramr::write_good_file(&quot;my_document.Rmd&quot;)</code> to run the checks on any Rmd file. This means you can use the functions without RStudio.</li>
<li>[something on the Shiny app from GS]</li>
<li>A shiny application can be launched with <code>gramr::run_grammar_checker(&quot;example.rmd&quot;)</code></li>
</ol>
<p>We collaborated on package development through the <a href="https://github.com/ropenscilabs/gramr/issues">gramr GitHub repository issue tracker</a> and a dedicated Slack channel in the rOpenSci Slack org.</p>
<div id="example-usage" class="section level3">
<h3>Example Usage</h3>
<p>We collaborated on package development through the <a href="https://github.com/ropenscilabs/gramr/issues">#gramr GitHub repository issue tracker</a> and a dedicated Slack channel in the rOpenSci Slack org.</p>
<p><strong>Example Usage</strong>:</p>
<pre class="r"><code># when the library is loaded it checks that the write-good javascript bundle is available
library(gramr)</code></pre>
<pre><code>## write-good has been loaded and is ready to use</code></pre>
Expand All @@ -151,7 +150,6 @@ <h3>Example Usage</h3>
<pre><code>## index offset reason
## 1 15 12 &quot;been defined&quot; may be passive voice
## 2 49 8 &quot;suddenly&quot; can weaken meaning</code></pre>
</div>



Expand Down
18 changes: 8 additions & 10 deletions R/grammar_checker.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Define UI for application that draws a histogram
library(shiny)
#' Start grammar checker
#'
#' @description Start the grammar checker. This allows the user to step through lines of code
#' which have grammar errors, and then write the resulting file.
#' @param
#' The filepath you wish to grammar check.
#' @return
#' @export
#' Start grammar checker shiny application
#' Start the grammar checker. This allows the user to step through lines of code
#' which have grammar errors, and then write the resulting file.
#' @param path the intended filepath
#' @return a shiny app is launched
#'
#' @examples
#' # don't run during tests
#' # gramr::run_grammar_checker("example.rmd")
#' @export
run_grammar_checker <- function(path){
text_df <- parse_rmd(path)
check_df <- text_df[purrr::map_lgl(text_df$grammar_check, ~!is.null(.)), ]
Expand Down

0 comments on commit 6a97850

Please sign in to comment.