Consider this code:
sample(1:20, 1)
If the result happens to be less than or equal to 10, can I get R to print out the number as a word. For example, if the result of sample(1:20, 1)
is 2, can I program R to print the result as two, if the result of sample(1:20, 1)
is 10, can I program R to print the result as ten, if the result of sample(1:20, 1)
is 13, can I program R to print the result as 13, and so on.
I am using knitr
to convert R code to latex for my thesis. My rule is any number less than or equal to 10 should be printed as word.