diff --git a/DESCRIPTION b/DESCRIPTION
index 6a9816c..b6c1740 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: r2eng
-Version: 0.0.0.9005
+Version: 0.0.0.9006
Type: Package
Title: Translate R Code To An English Sentence
Description: Take an R expression and convert it to English by matching
@@ -13,12 +13,11 @@ URL: https://github.com/matt-dray/r2eng/
BugReports: https://github.com/matt-dray/r2eng/issues
Encoding: UTF-8
LazyData: true
-RoxygenNote: 7.1.1
+RoxygenNote: 7.2.3
Language: en-GB
Depends:
R (>= 2.10)
Imports:
- lintr (>= 2.0.1),
purrr (>= 0.3.4),
rlang (>= 0.4.7),
utils
diff --git a/NEWS.md b/NEWS.md
index f254d83..410b128 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,7 @@
+# r2eng 0.0.0.9006
+
+* Removed {lintr} dependency.
+
# r2eng 0.0.0.9005
* BREAKING:
diff --git a/R/translate.R b/R/translate.R
index 4fc7577..5a83026 100644
--- a/R/translate.R
+++ b/R/translate.R
@@ -145,11 +145,9 @@ print.r2eng <- function(x, ...) {
}
.convert_expr_tree <- function(expression) {
- tmp <- tempfile()
- writeLines(expression, tmp)
- trees <- lintr::get_source_expressions(tmp)
- unlink(tmp)
- return(trees$expressions[[1]]$parsed_content[,c("token", "text")])
+ parsed <- parse(text = expression, keep.source = TRUE)
+ parse_data <- utils::getParseData(parsed)
+ parse_data[, c("token", "text")]
}
diff --git a/README.Rmd b/README.Rmd
index 904f45e..1de1853 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -49,7 +49,7 @@ You can install the development version of {r2eng} from GitHub with:
remotes::install_github("matt-dray/r2eng")
```
-This package depends on {lintr}, {purrr} and {rlang}.
+This package depends on {purrr} and {rlang}.
## Examples
@@ -95,7 +95,7 @@ Use `print` to print the R expression and English sentence.
print(obj)
```
-From your r2eng object you can access the original R expression (`r_expression`), English translation (`eng_expression`), quoted expression (`quoted_expression`). You can also access the parse tree output via {lintr} (`translation_map`):
+From your r2eng object you can access the original R expression (`r_expression`), English translation (`eng_expression`), quoted expression (`quoted_expression`). You can also access the parse tree output (`translation_map`):
```{r example-map}
head(obj$translation_map)
diff --git a/README.md b/README.md
index 324270d..0322be9 100644
--- a/README.md
+++ b/README.md
@@ -9,39 +9,43 @@
-[![Project Status: WIP – Initial development is in progress, but there
-has not yet been a stable, usable release suitable for the
-public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
-[![R build
-status](https://github.com/matt-dray/r2eng/workflows/R-CMD-check/badge.svg)](https://github.com/matt-dray/r2eng/actions)
-[![codecov](https://codecov.io/gh/matt-dray/r2eng/branch/master/graph/badge.svg)](https://codecov.io/gh/matt-dray/r2eng)
+[](https://www.repostatus.org/#wip)
+[](https://github.com/matt-dray/r2eng/actions)
+[](https://codecov.io/gh/matt-dray/r2eng)
[![Launch Rstudio
Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/matt-dray/try-r2eng/master?urlpath=rstudio)
-[![rostrum.blog post](https://img.shields.io/badge/rostrum.blog-post-008900?style=flat&labelColor=black&logo=data:image/gif;base64,R0lGODlhEAAQAPEAAAAAABWCBAAAAAAAACH5BAlkAAIAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAAQAAAC55QkISIiEoQQQgghRBBCiCAIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAAh+QQJZAACACwAAAAAEAAQAAAC55QkIiESIoQQQgghhAhCBCEIgiAIgiAIQiAIgSAIgiAIQiAIgRAEQiAQBAQCgUAQEAQEgYAgIAgIBAKBQBAQCAKBQEAgCAgEAoFAIAgEBAKBIBAQCAQCgUAgEAgCgUBAICAgICAgIBAgEBAgEBAgEBAgECAgICAgECAQIBAQIBAgECAgICAgICAgECAQECAQICAgICAgICAgEBAgEBAgEBAgICAgICAgECAQIBAQIBAgECAgICAgIBAgECAQECAQIBAgICAgIBAgIBAgEBAgECAgECAgICAgICAgECAgECAgQIAAAQIKAAA7)](https://www.rostrum.blog/2020/11/14/hello-r2eng/)
-Make R speakable\!
+Make R speakable!
The goal of {r2eng} (as in ‘R to English’) is to take an R expression
and ‘translate’ it to an English sentence.
The package is intended to:
- - improve communication between teachers and learners
- - make R discussions in English more accessible to non-English
- speakers
- - provide an extra audio evaluation tool for users who are blind or
- have low vision
- - be of interest to any R user that’s curious about how R expressions
- might be vocalised
+- improve communication between teachers and learners
+- make R discussions in English more accessible to non-English speakers
+- provide an extra audio evaluation tool for users who are blind or have
+ low vision
+- be of interest to any R user that’s curious about how R expressions
+ might be vocalised
-The project was inspired by [Amelia
-McNamara](https://twitter.com/AmeliaMN)‘s useR\! 2020 talk called
-’Speaking R’ ([YouTube](https://www.youtube.com/watch?v=ckW9sSdIVAc),
-[slides](https://www.amelia.mn/SpeakingR/#1)).
+The project was inspired by
+Amelia
+McNamara‘s useR! 2020 talk called ’Speaking R’
+(YouTube,
+slides).
This project is a work in progress and highly opinionated. Contributions
-are welcome, but please see the [Code of Conduct](#conduct).
+are welcome, but please see the
+Code of Conduct.
## Installation
@@ -51,13 +55,14 @@ You can install the development version of {r2eng} from GitHub with:
remotes::install_github("matt-dray/r2eng")
```
-This package depends on {lintr}, {purrr} and {rlang}.
+This package depends on {purrr} and {rlang}.
## Examples
-The main function in the package is `translate()`. It uses [non-standard
-evaluation](http://adv-r.had.co.nz/Computing-on-the-language.html), so
-you pass it a bare R expression like this:
+The main function in the package is `translate()`. It uses
+non-standard evaluation, so you pass it a bare R
+expression like this:
``` r
r2eng::translate(variable <- 1, speak = TRUE)
@@ -111,16 +116,16 @@ print(obj)
From your r2eng object you can access the original R expression
(`r_expression`), English translation (`eng_expression`), quoted
expression (`quoted_expression`). You can also access the parse tree
-output via {lintr} (`translation_map`):
+output (`translation_map`):
``` r
head(obj$translation_map)
# token text eng
-# 40 expr
+# 45 expr
# 1 SYMBOL hello hello
# 3 expr
# 2 LEFT_ASSIGN <- gets
-# 38 expr
+# 43 expr
# 4 SYMBOL_FUNCTION_CALL c a vector of
```
@@ -168,8 +173,9 @@ assignment versus specifying arguments, but feeding an expression such
as `x = c(1, 2, 3)` would confuse `translate()` that you want to pass an
argument `c(1, 2, 3)` to the parameter `x`.
-This is because `translate()` uses [non-standard
-evaluation](http://adv-r.had.co.nz/Computing-on-the-language.html).
+This is because `translate()` uses
+non-standard evaluation.
In such cases, you must use `translate_string()` instead:
@@ -192,12 +198,13 @@ expression:
## RStudio addin
-Installing this package also installs an [RStudio
-addin](https://rstudio.github.io/rstudioaddins/).
+Installing this package also installs an
+RStudio addin.
Select an R expression in the editor and then under ‘Addins’, go to
-‘Speak R Expression In English’ under ‘R2ENG’. The selected text will
-be spoken by your computer.
+‘Speak R Expression In English’ under ‘R2ENG’. The selected text will be
+spoken by your computer.
You could bind this addin to a keyboard shortcut in RStudio by going to
‘Tools’, then ‘Modify Keyboard Shortcuts…’. Perhaps Cmd +
@@ -212,11 +219,11 @@ translation
## Contributions and Code of Conduct
-Contributions are welcome from everyone. Please first [add an
-issue](https://github.com/matt-dray/r2eng/issues) if a relevant one one
-doesn’t already exist.
+Contributions are welcome from everyone. Please first
+add
+an issue if a relevant one one doesn’t already exist.
-Please note that the {r2eng} project is released with a [Contributor
-Code of
-Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
-By contributing to this project, you agree to abide by its terms.
+Please note that the {r2eng} project is released with a Contributor Code of Conduct. By contributing to this
+project, you agree to abide by its terms.
diff --git a/man/r2eng-package.Rd b/man/r2eng-package.Rd
index e372da2..57cb552 100644
--- a/man/r2eng-package.Rd
+++ b/man/r2eng-package.Rd
@@ -6,9 +6,7 @@
\alias{r2eng-package}
\title{r2eng: Translate R Code To An English Sentence}
\description{
-Take an R expression and convert it to English by matching
- recognised symbols with an opinionated list of English 'translations'.
- Inspired By Amelia McNamara's useR! 2020 conference talk.
+Take an R expression and convert it to English by matching recognised symbols with an opinionated list of English 'translations'. Inspired By Amelia McNamara's useR! 2020 conference talk.
}
\seealso{
Useful links: