This will eventually be an R package, but for now source it within your R script:
source("quantile_names.R")
print(quantile_names(c(1:29), n = 7))
[1] "1st" "1st" "1st" "1st" "2nd" "2nd" "2nd" "2nd" "3rd" "3rd" "3rd"
[12] "3rd" "4th" "4th" "4th" "4th" "5th" "5th" "5th" "5th" "6th" "6th"
[23] "6th" "6th" "7th" "7th" "7th" "7th" "7th"