diff --git a/.Rbuildignore b/.Rbuildignore index 30dab5b..696b9a4 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,4 +10,5 @@ ^\.Rproj\.user$ ^CITATION\.cff$ ^__.*$ -^\.vscode.* \ No newline at end of file +^\.vscode.* +^cran-comments\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 0df633e..6621763 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: numberize -Title: Convert Words To Numbers In Multiple Languages -Version: 1.0.0 +Title: Convert Words to Numbers in Multiple Languages +Version: 0.0.1 Authors@R: c( person("Chris", "Hartgerink", , "chris@libscie.org", role = "rev", comment = c(ORCID = "0000-0003-1050-6809")), diff --git a/R/numberize.R b/R/numberize.R index fe506b0..6bbd1c8 100644 --- a/R/numberize.R +++ b/R/numberize.R @@ -1,4 +1,3 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #' Generate a numeric vector from text in a supported language. #' #' @param text Word(s) that spell numbers. e.g. "one", "deux", "trois" @@ -6,7 +5,6 @@ #' #' @return A numeric vector. #' @keywords internal -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ digits_from <- function(text, lang = "en") { invalid_structure <- function(positions) { valid_position <- c( @@ -134,7 +132,6 @@ digits_from <- function(text, lang = "en") { numbers[match(words, numbers[[lang]]), "digit"] } -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #' Generate a number from a numeric vector. #' Uses `digits_from()` output to generate the numeric value of the text. #' @@ -143,7 +140,6 @@ digits_from <- function(text, lang = "en") { #' @return A numeric value. #' #' @keywords internal -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ number_from <- function(digits) { thousand_index <- match(1000, digits, nomatch = 0) million_index <- match(1E6, digits, nomatch = 0) diff --git a/README.Rmd b/README.Rmd index 7703a12..5ce3816 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,11 +21,11 @@ knitr::opts_chunk$set( # _{{ packagename }}_ -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit) [![R-CMD-check](https://github.com/{{ gh_repo }}/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/{{ gh_repo }}/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/{{ gh_repo }}/branch/main/graph/badge.svg)](https://app.codecov.io/gh/{{ gh_repo }}?branch=main) [![lifecycle-{{ recon }}](https://www.reconverse.org/images/badge-{{ recon }}.svg)](https://www.reconverse.org/lifecycle.html#{{ recon }}) -[![CRAN status](https://www.r-pkg.org/badges/version/{{ packagename }})](https://CRAN.R-project.org/package={{ packagename }}) + @@ -37,6 +37,14 @@ _{{ packagename }}_ is developed at the [{{ department }}]({{ department_url }}) ## Installation +The package can be installed from CRAN using + +```r +install.packages("{{packagename}}") +``` + +### Development version + You can install the development version of _{{ packagename }}_ from [GitHub](https://github.com/) with: @@ -44,15 +52,13 @@ You can install the development version of _{{ packagename }}_ from pak::pak("{{ gh_repo }}") ``` -```{r} -library("numberize") -``` - ## Example These examples illustrate the current functionality. ```{r eval=TRUE} +library("numberize") + # numberize a French string numberize("zéro", lang = "fr") @@ -75,9 +81,9 @@ numberize( ## Related packages and Limitations - [`{numberwang}`](https://github.com/coolbutuseless/numberwang) converts numbers to words and vice versa. Limitation: English only, not on CRAN. -- [`{nombre}`](https://cran.r-project.org/web/packages/nombre/index.html) converts numerics into words. Limitation: English only, no word to number conversion. -- [`{english}`](https://cran.r-project.org/web/packages/english/index.html) converts numerics into words. Limitation: English only, no word to number conversion. -- [`{spanish}`](https://cran.r-project.org/web/packages/spanish/index.html) converts numbers to words and vice versa. Limitation: Spanish only. +- [`{nombre}`](https://CRAN.R-project.org/package=nombre) converts numerics into words. Limitation: English only, no word to number conversion. +- [`{english}`](https://CRAN.R-project.org/package=english) converts numerics into words. Limitation: English only, no word to number conversion. +- [`{spanish}`](https://CRAN.R-project.org/package=spanish) converts numbers to words and vice versa. Limitation: Spanish only. _{{ packagename }}_ is released as a standalone package in the hope that it will be useful to the R community at large. _{{ packagename }}_ was created in response to data cleaning requirements in [{cleanepi}](https://github.com/epiverse-trace/cleanepi). diff --git a/README.md b/README.md index 63a3767..7a39bdf 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,12 @@ [![License: -MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/) +MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit) [![R-CMD-check](https://github.com/epiverse-trace/numberize/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/epiverse-trace/numberize/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/epiverse-trace/numberize/branch/main/graph/badge.svg)](https://app.codecov.io/gh/epiverse-trace/numberize?branch=main) [![lifecycle-stable](https://www.reconverse.org/images/badge-stable.svg)](https://www.reconverse.org/lifecycle.html#stable) -[![CRAN -status](https://www.r-pkg.org/badges/version/numberize)](https://CRAN.R-project.org/package=numberize) + @@ -40,15 +39,19 @@ at the London School of Hygiene and Tropical Medicine as part of the ## Installation -You can install the development version of *numberize* from -[GitHub](https://github.com/) with: +The package can be installed from CRAN using ``` r -pak::pak("epiverse-trace/numberize") +install.packages("numberize") ``` +### Development version + +You can install the development version of *numberize* from +[GitHub](https://github.com/) with: + ``` r -library("numberize") +pak::pak("epiverse-trace/numberize") ``` ## Example @@ -56,6 +59,8 @@ library("numberize") These examples illustrate the current functionality. ``` r +library("numberize") + # numberize a French string numberize("zéro", lang = "fr") #> [1] 0 @@ -87,14 +92,14 @@ numberize( - [`{numberwang}`](https://github.com/coolbutuseless/numberwang) converts numbers to words and vice versa. Limitation: English only, not on CRAN. - - [`{nombre}`](https://cran.r-project.org/web/packages/nombre/index.html) - converts numerics into words. Limitation: English only, no word to - number conversion. - - [`{english}`](https://cran.r-project.org/web/packages/english/index.html) - converts numerics into words. Limitation: English only, no word to - number conversion. - - [`{spanish}`](https://cran.r-project.org/web/packages/spanish/index.html) - converts numbers to words and vice versa. Limitation: Spanish only. + - [`{nombre}`](https://CRAN.R-project.org/package=nombre) converts + numerics into words. Limitation: English only, no word to number + conversion. + - [`{english}`](https://CRAN.R-project.org/package=english) converts + numerics into words. Limitation: English only, no word to number + conversion. + - [`{spanish}`](https://CRAN.R-project.org/package=spanish) converts + numbers to words and vice versa. Limitation: Spanish only. *numberize* is released as a standalone package in the hope that it will be useful to the R community at large. *numberize* was created in diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..858617d --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,5 @@ +## R CMD check results + +0 errors | 0 warnings | 1 note + +* This is a new release. diff --git a/tests/spelling.R b/tests/spelling.R index 9e8985d..647406c 100644 --- a/tests/spelling.R +++ b/tests/spelling.R @@ -2,6 +2,6 @@ if (requireNamespace("spelling", quietly = TRUE)) { spelling::spell_check_test( vignettes = TRUE, error = TRUE, - skip_on_cran = FALSE + skip_on_cran = TRUE ) }