xfun icon indicating copy to clipboard operation
xfun copied to clipboard

In joining number words by and

Open msgoussi opened this issue 4 years ago • 4 comments

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.

msgoussi avatar Sep 04 '19 06:09 msgoussi

Can anyone help? (perhaps @daijiang?)

yihui avatar Sep 04 '19 14:09 yihui

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.

daijiang avatar Sep 04 '19 14:09 daijiang

> 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.

harshvardhaniimi avatar Nov 08 '21 14:11 harshvardhaniimi

@harshvardhaniimi Sure! We appreciate it.

yihui avatar Nov 08 '21 14:11 yihui

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!

harshvardhaniimi avatar Apr 25 '23 04:04 harshvardhaniimi