Skip to content

Commit

Permalink
README.Rmd and md update
Browse files Browse the repository at this point in the history
  • Loading branch information
bahadzie committed Jul 24, 2024
1 parent c68294d commit b846853
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ numberize(
)
```

## Related packages andLimitations
## 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.
Expand Down
48 changes: 34 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

<!-- README.md is generated from README.Rmd. Please edit that file. -->

<!-- The code to render this README is stored in .github/workflows/render-readme.yaml -->

<!-- Variables marked with double curly braces will be transformed beforehand: -->

<!-- `packagename` is extracted from the DESCRIPTION file -->

<!-- `gh_repo` is extracted via a special environment variable in GitHub Actions -->

# *numberize* <img src="man/figures/logo.svg" align="right" width="120" />
Expand All @@ -21,9 +25,10 @@ status](https://www.r-pkg.org/badges/version/numberize)](https://CRAN.R-project.
<!-- badges: end -->

*numberize* is an R package to convert numbers written as English,
French or Spanish words from `"zero"` to
`"nine hundred and ninety nine trillion, nine hundred and ninety nine billion, nine hundred and ninety nine million, nine hundred and ninety nine thousand, nine hundred and ninety nine"`
from a character string to a numeric value.
French or Spanish words from `"zero"` to `"nine hundred and ninety nine
trillion, nine hundred and ninety nine billion, nine hundred and ninety
nine million, nine hundred and ninety nine thousand, nine hundred and
ninety nine"` from a character string to a numeric value.

<!-- This sentence is optional and can be removed -->

Expand Down Expand Up @@ -54,20 +59,35 @@ These examples illustrate the current functionality.
# numberize a French string
numberize("zéro", lang = "fr")
#> [1] 0
```

``` r

# numberize a Spanish string
numberize("Siete mil quinientos cuarenta y cinco", lang = "es")
#> [1] 7545
```

``` r

# numberize the English string "nine hundred and ninety-nine trillion, nine hundred and ninety-nine billion, nine hundred and ninety-nine million, nine hundred and ninety-nine thousand, nine hundred and ninety-nine" # nolint: line_length_linter.
formatC(numberize("nine hundred and ninety-nine trillion, nine hundred and ninety-nine billion, nine hundred and ninety-nine million, nine hundred and ninety-nine thousand, nine hundred and ninety-nine"), big.mark = ",", format = "fg") # nolint: line_length_linter.
#> [1] "999,999,999,999,999"
```

``` r

# some edge cases
numberize("veintiún", lang = "es")
#> [1] 21
```

``` r
numberize("veintiuno", lang = "es")
#> [1] 21
```

``` r

# convert a vector of written values
numberize(
Expand All @@ -79,17 +99,17 @@ numberize(

## Related packages andLimitations

- [`{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.
- [`{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.

*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
Expand Down

0 comments on commit b846853

Please sign in to comment.