JeanVuda
JeanVuda

Reputation: 1778

Create strings from numbers

How do I make word form of numbers? I have numbers and wondering how do I convert them to strings?

1 to 1st
2 to 2nd
3 to 3rd
.
.
11 to 11th
.
21 to 21st
etc

Upvotes: 1

Views: 68

Answers (1)

Rorschach
Rorschach

Reputation: 32426

From example ?ordinal_format in scales

library(scales)
ordinal_format()(1:10)
# [1] "1st"  "2nd"  "3rd"  "4th"  "5th"  "6th"  "7th"  "8th"  "9th"  "10th"

Upvotes: 5

Related Questions