|
|
|
|
|
|
|
|
being actively |
|
|
being actively |
|
|
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) |
|
|
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) |
|
|
[](https://cran.r-project.org/package=regexplain) |
|
|
[](https://cran.r-project.org/package=regexplain) |
|
|
<!-- [](/commits/master) --> |
|
|
|
|
|
|
|
|
<!-- [](/commits/master) --> |
|
|
|
|
|
|
|
|
<!-- Links --> |
|
|
<!-- Links --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Installation |
|
|
## Installation |
|
|
|
|
|
|
|
|
Installation is easy with `devtools` |
|
|
|
|
|
|
|
|
Installation is easy with `remotes` |
|
|
|
|
|
|
|
|
``` r |
|
|
``` r |
|
|
devtools::install_github("gadenbuie/regexplain") |
|
|
|
|
|
|
|
|
# install.packages("remotes") |
|
|
|
|
|
remotes::install_github("gadenbuie/regexplain") |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
or for hands-free installation |
|
|
|
|
|
|
|
|
|
|
|
source("https://install-github.me/gadenbuie/regexplain") |
|
|
|
|
|
|
|
|
|
|
|
## RegExplain in Action |
|
|
## RegExplain in Action |
|
|
|
|
|
|
|
|
#### Overview |
|
|
#### Overview |
|
|
|
|
|
|
|
|
The main feature of this package is the RStudio Addin **RegExplain |
|
|
The main feature of this package is the RStudio Addin **RegExplain |
|
|
Selection**. Just select the text or object containing text (such as the |
|
|
Selection**. Just select the text or object containing text (such as the |
|
|
variable name of a vector or a data.frame column) and run **RegExplain |
|
|
variable name of a vector or a data.frame column) and run **RegExplain |
|
|
Selection** from the RStudio Addins |
|
|
|
|
|
dropdown. |
|
|
|
|
|
|
|
|
Selection** from the RStudio Addins dropdown. |
|
|
|
|
|
|
|
|
<img src="docs/rstudio-addin-list.png" width = "250px;" alt="regexplain in the Rstudio Addins dropdown"> |
|
|
<img src="docs/rstudio-addin-list.png" width = "250px;" alt="regexplain in the Rstudio Addins dropdown"> |
|
|
|
|
|
|
|
|
|
|
|
You can also open the addin with `regexplain_gadget()`. This allows you |
|
|
|
|
|
to pass text or a regular expression to the gadget, which is useful when |
|
|
|
|
|
you want to work with a regular expression in your code or environment. |
|
|
|
|
|
|
|
|
|
|
|
``` r |
|
|
|
|
|
regexplain_gadget(text_vector, "\\b(red|blue|green): \\d{3}") |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
The addin will open an interface with 4 panes where you can |
|
|
The addin will open an interface with 4 panes where you can |
|
|
|
|
|
|
|
|
- edit the **text** you’ve imported |
|
|
- edit the **text** you’ve imported |
|
|
|
|
|
|
|
|
 |
|
|
 |
|
|
|
|
|
|
|
|
When you’re done, click on the **Send Regex to Console** to send your |
|
|
When you’re done, click on the **Send Regex to Console** to send your |
|
|
regex expression to… the |
|
|
|
|
|
console\! |
|
|
|
|
|
|
|
|
regex expression to… the console\! |
|
|
|
|
|
|
|
|
``` r |
|
|
``` r |
|
|
> pattern <- "\\b(red|orange|yellow|green|blue|purple|white|brown)(?:\\s(\\w+))?" |
|
|
> pattern <- "\\b(red|orange|yellow|green|blue|purple|white|brown)(?:\\s(\\w+))?" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The full library is stored as a JSON file in |
|
|
The full library is stored as a JSON file in |
|
|
[inst/extdata/patterns.json](/inst/extdata/patterns.json), feel free to |
|
|
[inst/extdata/patterns.json](/inst/extdata/patterns.json), feel free to |
|
|
contribute patterns you find useful or use regularly via pull |
|
|
|
|
|
request. |
|
|
|
|
|
|
|
|
contribute patterns you find useful or use regularly via pull request. |
|
|
|
|
|
|
|
|
<img src="docs/regexplain-gadget-library.png" height="400px" alt="regexplain library modal"> |
|
|
<img src="docs/regexplain-gadget-library.png" height="400px" alt="regexplain library modal"> |
|
|
|
|
|
|