qdapRegex
qdapRegex is a collection of regular expression tools associated with the qdap package that may be useful outside of the context of discourse analysis.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.0%) to scientific vocabulary
Keywords
qdapregex
r
regular-expression
Last synced: 6 months ago
·
JSON representation
Repository
qdapRegex is a collection of regular expression tools associated with the qdap package that may be useful outside of the context of discourse analysis.
Statistics
- Stars: 50
- Watchers: 7
- Forks: 4
- Open Issues: 7
- Releases: 7
Topics
qdapregex
r
regular-expression
Created over 11 years ago
· Last pushed 11 months ago
Metadata Files
Readme
README.Rmd
# qdapRegex
```{r, echo=FALSE}
desc <- suppressWarnings(readLines("DESCRIPTION"))
regex <- "(^Version:\\s+)(\\d+\\.\\d+\\.\\d+)"
loc <- grep(regex, desc)
ver <- gsub(regex, "\\2", desc[loc])
verbad <- sprintf('
', ver, ver)
````
[](https://www.repostatus.org/#inactive)
[](https://coveralls.io/github/trinker/qdapRegex)

[qdapRegex](https://CRAN.R-project.org/package=qdapRegex) is a collection of regular expression tools associated with the **qdap** package that may be useful outside of the context of discourse analysis. Tools include removal/extraction/replacement of abbreviations, dates, dollar amounts, email addresses, hash tags, numbers, percentages, citations, person tags, phone numbers, times, and zip codes. Functions that remove/replace are prefixed with `rm_`. Each of these functions has an extraction counterpart prefixed with `ex_`.
The **qdapRegex** package does not aim to compete with string manipulation packages such as [**stringr**](https://CRAN.R-project.org/package=stringr) or [**stringi**](https://CRAN.R-project.org/package=stringi) but is meant to provide access to canned, common regular expression patterns that can be used within **qdapRegex**, with **R**'s own regular expression functions, or add on string manipulation packages such as **stringr** and **stringi**.
The functions in **qdapRegex** work on a dictionary system. The current implementation defaults to a United States flavor of canned regular expressions. Users may submit proposed region specific regular expression dictionaries that contain the same fields as the [`regex_usa`](https://trinker.github.io/qdapRegex/regex_usa.html) data set or improvements to regular expressions in current dictionaries. Please submit proposed regional regular expression dictionaries via: https://github.com/trinker/qdapRegex/issues
## Educational
The **qdapRegex** package serves a dual purpose of being both functional and educational. While the canned regular expressions are useful in and of themselves they also serve as a platform for understanding regular expressions in the context of meaningful, purposeful usage. In the same way I learned guitar while trying to mimic Eric Clapton, not by learning scales and theory, some folks may enjoy an approach of learning regular expressions in a more pragmatic, experiential interaction. Users are encouraged to look at the regular expressions being used ([`?regex_usa`](https://trinker.github.io/qdapRegex/regex_usa.html) and [`?regex_supplement`](https://trinker.github.io/qdapRegex/regex_supplement.html) are the default regular expression dictionaries used by **qdapRegex**) and unpack how they work. I have found slow repeated exposures to information in a purposeful context results in acquired knowledge.
The following regular expressions sites were very helpful to my own regular expression education:
1. [Regular-Expression.info](https://www.regular-expressions.info/tutorial.html)
2. [Rex Egg](https://www.rexegg.com/)
3. [Regular Expressions as used in R](https://stat.ethz.ch/R-manual/R-devel/library/base/html/regex.html)
4. [Debuggex (Visualizing Regex)](https://www.debuggex.com)
Being able to discuss and ask questions is also important to learning...in this case regular expressions. I have found the following forums extremely helpful to learning about regular expressions:
1. [stackoverflow](https://stackoverflow.com/) + [Posting Guidelines](https://trinker.github.io/stackoverflow/)
## Installation
To download the development version of qdapRegex:
Download the [zip ball](https://github.com/trinker/qdapRegex/zipball/master) or [tar ball](https://github.com/trinker/qdapRegex/tarball/master), decompress and run `R CMD INSTALL` on it, or use the **pacman** package to install the development version:
```r
if (!require("pacman")) install.packages("pacman")
pacman::p_load_gh("trinker/qdapRegex")
```
## Contact
You are welcome to:
* submit suggestions and bug-reports at:
* send a pull request on:
* compose a friendly e-mail to:
## Examples
The following examples demonstrate some of the functionality of **qdapRegex**.
```{r, echo-FALSE}
library(qdapRegex)
```
### Extract Citations
```{r}
w <- c("Hello World (V. Raptor, 1986) bye (Foo, 2012, pp. 1-2)",
"Narcissism is not dead (Rinker, 2014)",
"The R Core Team (2014) has many members.",
paste("Bunn (2005) said, \"As for elegance, R is refined, tasteful, and",
"beautiful. When I grow up, I want to marry R.\""),
"It is wrong to blame ANY tool for our own shortcomings (Baer, 2005).",
"Wickham's (in press) Tidy Data should be out soon.",
"Rinker's (n.d.) dissertation not so much.",
"I always consult xkcd comics for guidance (Foo, 2012; Bar, 2014).",
"Uwe Ligges (2007) says, \"RAM is cheap and thinking hurts\"",
"Silly (Bar, 2014) stuff is what Bar (2014, 2012) said."
)
ex_citation(w)
as_count(ex_citation(w))
```
### Extract Twitter Hash Tags, Name Tags, & URLs
```{r}
x <- c("@hadley I like #rstats for #ggplot2 work.",
"Difference between #magrittr and #pipeR, both implement pipeline operators for #rstats:
http://renkun.me/r/2014/07/26/difference-between-magrittr-and-pipeR.html @timelyportfolio",
"Slides from great talk: @ramnath_vaidya: Interactive slides from Interactive Visualization
presentation #user2014. http://ramnathv.github.io/user2014-rcharts/#1"
)
ex_hash(x)
ex_tag(x)
ex_url(x)
```
### Extract Bracketed Text
```{r}
y <- c("I love chicken [unintelligible]!",
"Me too! (laughter) It's so good.[interrupting]",
"Yep it's awesome {reading}.", "Agreed. {is so much fun}")
ex_bracket(y)
ex_curly(y)
ex_round(y)
ex_square(y)
````
### Extract Numbers
```{r}
z <- c("-2 is an integer. -4.3 and 3.33 are not.",
"123,456 is a lot more than -.2",
"hello world -.q")
rm_number(z)
ex_number(z)
as_numeric(ex_number(z))
```
### Extract Times
```{r}
x <- c(
"I'm getting 3:04 AM just fine, but...",
"for 10:47 AM I'm getting 0:47 AM instead.",
"no time here",
"Some time has 12:04 with no AM/PM after it",
"Some time has 12:04 a.m. or the form 1:22 pm"
)
ex_time(x)
as_time(ex_time(x))
as_time(ex_time(x), as.POSIXlt = TRUE)
```
### Remove Non-Words & N Character Words
```{r}
x <- c(
"I like 56 dogs!",
"It's seventy-two feet from the px290.",
NA,
"What",
"that1is2a3way4to5go6.",
"What do you*% want? For real%; I think you'll see.",
"Oh some code to remove"
)
rm_non_words(x)
rm_nchar_words(rm_non_words(x), "1,2")
```
Owner
- Name: Tyler Rinker
- Login: trinker
- Kind: user
- Location: Buffalo, NY
- Company: Anthology
- Website: http://trinkerrstuff.wordpress.com/
- Repositories: 131
- Profile: https://github.com/trinker
Director, Data Scientist, open-source developer , #rstats enthusiast, #dataviz geek, and #nlp buff
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| trinker | t****r@g****m | 238 |
| TylerRinker | t****r@c****m | 7 |
| Tyler Rinker | t****r@k****m | 3 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 35
- Total pull requests: 0
- Average time to close issues: 8 months
- Average time to close pull requests: N/A
- Total issue authors: 13
- Total pull request authors: 0
- Average comments per issue: 1.29
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- trinker (22)
- bes827 (2)
- maelle (1)
- dswpg (1)
- bedantaguru (1)
- zachmayer (1)
- aedobbyn (1)
- pieterjanvc (1)
- stevesolun (1)
- markvanderloo (1)
- sanjmeh (1)
- mobcdi (1)
- JuKo007 (1)
Pull Request Authors
Top Labels
Issue Labels
bug (6)
enhancement (5)
question (2)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 7,548 last-month
- Total docker downloads: 44,303
-
Total dependent packages: 16
(may contain duplicates) -
Total dependent repositories: 29
(may contain duplicates) - Total versions: 14
- Total maintainers: 1
cran.r-project.org: qdapRegex
Regular Expression Removal, Extraction, and Replacement Tools
- Homepage: https://github.com/trinker/qdapRegex
- Documentation: http://cran.r-project.org/web/packages/qdapRegex/qdapRegex.pdf
- License: GPL-2
-
Latest release: 0.7.10
published 11 months ago
Rankings
Downloads: 3.6%
Dependent packages count: 4.4%
Dependent repos count: 5.0%
Stargazers count: 6.8%
Average: 9.1%
Forks count: 10.8%
Docker downloads count: 24.2%
Maintainers (1)
Last synced:
6 months ago
conda-forge.org: r-qdapregex
- Homepage: http://trinker.github.com/qdapRegex/
- License: GPL-2.0-only
-
Latest release: 0.7.5
published almost 4 years ago
Rankings
Dependent packages count: 15.6%
Average: 33.8%
Dependent repos count: 34.0%
Stargazers count: 37.7%
Forks count: 47.7%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.5.0 depends
- stringi >= 0.5 imports
- testthat * suggests