Title: | Convert Words to Numbers in Multiple Languages |
Version: | 1.0.2 |
Description: | Converts number spellings into their equivalent numbers. Supports numbers written in English, French, or Spanish. |
License: | MIT + file LICENSE |
URL: | https://github.com/epiverse-trace/numberize |
BugReports: | https://github.com/epiverse-trace/numberize/issues |
Depends: | R (≥ 3.5.0) |
Suggests: | spelling, testthat (≥ 3.0.0) |
Config/Department: | Centre for the Mathematical Modelling of Infectious Diseases |
Config/DepartmentURL: | https://www.lshtm.ac.uk/research/centres/centre-mathematical-modelling-infectious-diseases |
Config/Institution: | London School of Hygiene and Tropical Medicine |
Config/Needs/website: | epiverse-trace/epiversetheme |
Config/Recon: | stable |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.3.1 |
NeedsCompilation: | no |
Packaged: | 2025-04-08 13:28:31 UTC; bahadzie |
Author: | Chris Hartgerink |
Maintainer: | Bankole Ahadzie <bankole.ahadzie@lshtm.ac.uk> |
Repository: | CRAN |
Date/Publication: | 2025-04-08 23:30:16 UTC |
Test if a given numeric vector can have different meanings.
Description
Test if a given numeric vector can have different meanings.
Usage
ambiguous(digits)
Arguments
digits |
A numeric vector. |
Value
Logical. True if the number vector has multiple interpretations.
Generate a numeric vector from text in a supported language.
Description
Generate a numeric vector from text in a supported language.
Usage
digits_from(text, lang = "en")
Arguments
text |
Word(s) that spell numbers. e.g. "one", "deux", "trois" |
lang |
The text's language. Currently one of |
Value
A numeric vector.
Generate a number from a numeric vector.
Uses digits_from()
output to generate the numeric value of the text.
Description
Generate a number from a numeric vector.
Uses digits_from()
output to generate the numeric value of the text.
Usage
number_from(digits)
Arguments
digits |
A numeric vector translated from words. |
Value
A numeric value.
Convert a vector string of spelled numbers in a supported language to its numeric equivalent.
Description
The range of words supported is between zero and 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
Usage
numberize(text, lang = c("en", "fr", "es"))
Arguments
text |
String vector of spelled numbers in a supported language. |
lang |
The text's language. Currently one of |
Value
A numeric vector.
Examples
# convert to numbers a scalar
numberize("five hundred and thirty eight")
# convert a vector of values
numberize(c("dix", "soixante-cinq", "deux mille vingt-quatre"), lang = "fr")