yihui / xfun

Miscellaneous R functions
https://yihui.org/xfun/
Other
141 stars 28 forks source link

In joining number words by and #18

Closed msgoussi closed 1 year ago

msgoussi commented 5 years ago

xfun::numbers_to_words(1500780) [1] "one million, five hundred thousand, seven hundred eighty" I guess it should be [1] "one million, five hundred thousand, seven hundred and eighty"

also xfun::numbers_to_words(1500780.95) Error in xfun::numbers_to_words(1500780.95) : The numbers must be integer. i guess it should be one million, five hundred thousand, seven hundred eighty and ninety five hundredths

Thanks.

yihui commented 5 years ago

Can anyone help? (perhaps @daijiang?)

daijiang commented 5 years ago

For the first one, use xfun::numbers_to_words(1500780, and = TRUE).

For the second one, currently, xfun::numbers_to_words() only works for integers. I am not sure how likely people want to spell out numbers that are not integers.

harshvardhaniimi commented 2 years ago
> xfun::numbers_to_words(1500780.95)

I had to search the grammar rules for this and the common convention is to pronounce it as one million, five hundred thousand, seven hundred eighty point nine five.

@yihui If this sounds appropriate, I can help implement it.

yihui commented 2 years ago

@harshvardhaniimi Sure! We appreciate it.

harshvardhaniimi commented 1 year ago

Sorry for the year-long radio silence on this. I've created a pull request for this. I'm not experienced at this so if any changes are needed, please suggest them. Thanks!