as.english: "_PACKAGE" Numbers in Englis Words

Description Usage Arguments Value Examples

Description

Converts numerical vectors into object that display as English words

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
as.english(x, ...)

english(x, ...)

## Default S3 method:
english(x, ...)

## S3 method for class 'numeric'
english(x, UK, ...)

## S3 method for class 'english'
as.numeric(x, ...)

## S3 method for class 'english'
print(x, ...)

## S3 method for class 'english'
rep(x, ...)

## S3 method for class 'english'
x[i]

## S3 method for class 'english'
format(x, ...)

## S3 method for class 'english'
as.character(x, ...)

## S3 method for class 'english'
sort(x, decreasing = FALSE, ...)

Arguments

x

A numerical vector, usually integer.

...

Additional arguments passed on, currently mostly ignored

UK

Logical, Use the UK (English) style (TRUE) or the USA (American) style (FALSE). The default can be set as options(english.UK = TRUE); if unset, a suitable style is guessed from the user's current locale.

i

Index vector of any kind

decreasing

Logical: should the sorting be in decreasing order?

Value

A numerical object that can be printed as English words, or coerced to character as English words

Examples

1
2
3
4
5
6
7
8
9
english(10000) + (-5):5
set.seed(123)
(jumble <- english(sample(1:20)))
sort(jumble)
(x <- english(sample(1:100, 10)))
sort(x)
toupper(english(1:10))
## For mothers of small children:
cat(paste("This is the", ordinal(1:5), "time I've told you!"), sep = "\n")

Example output

 [1] nine thousand nine hundred and ninety five 
 [2] nine thousand nine hundred and ninety six  
 [3] nine thousand nine hundred and ninety seven
 [4] nine thousand nine hundred and ninety eight
 [5] nine thousand nine hundred and ninety nine 
 [6] ten thousand                               
 [7] ten thousand and one                       
 [8] ten thousand and two                       
 [9] ten thousand and three                     
[10] ten thousand and four                      
[11] ten thousand and five                      
 [1] six       fifteen   eight     sixteen   seventeen one       eighteen 
 [8] twelve    seven     twenty    ten       five      eleven    nine     
[15] nineteen  thirteen  fourteen  four      three     two      
 [1] one       two       three     four      five      six       seven    
 [8] eight     nine      ten       eleven    twelve    thirteen  fourteen 
[15] fifteen   sixteen   seventeen eighteen  nineteen  twenty   
 [1] eighty nine  sixty nine   sixty three  ninety seven ninety eight
 [6] sixty eight  fifty two    fifty six    twenty seven fourteen    
 [1] fourteen     twenty seven fifty two    fifty six    sixty three 
 [6] sixty eight  sixty nine   eighty nine  ninety seven ninety eight
 [1] "ONE"   "TWO"   "THREE" "FOUR"  "FIVE"  "SIX"   "SEVEN" "EIGHT" "NINE" 
[10] "TEN"  
This is the first time I've told you!
This is the second time I've told you!
This is the third time I've told you!
This is the fourth time I've told you!
This is the fifth time I've told you!

english documentation built on Aug. 21, 2021, 9:07 a.m.