I have some dates, which I can extract the day of the month from: 

```
trimws(format(seq.Date(
  from = as.Date("2016-01-01"),
  to = as.Date("2016-10-01"), by = "day"), "%e"))

```

I would like to format the dates with suffixes "th", "rd" or "nd" as appropriate. So, "1st", "2nd", "3rd", etc. Is there an easy way to accomplish this, or will I have to enumerate the rules? 

---

I can implement this as a brute force lookup: 

```
df_dates = data_frame(
  day = seq.int(31),
  suffix = c(
    "st",
    "nd",
    "rd",
    rep("th", 17),
    "st",
    "nd",
    "rd",
    rep("th", 7),
    "st"
  )
)

```

but a more elegant solution would be welcome.