a handy function "format.cardinal", looking for a proper name..

Philippe Lambert phlamber@luc.ac.be
Thu, 19 Mar 1998 12:11:33 +0100 (MET)


On Thu, 19 Mar 1998, Martin Maechler wrote:

> This is not a nice name (format is generic; cardinal is not a class) for a
> nice function, which I would like in several places in R code and therefore
> would like to become part of R  (under a better name !)
> 
> format.cardinal <- function(i, sep="")
>         paste(i, c("st","nd","rd","th")[pmin(4,i)], sep=sep)
> 
> # Try
> format.cardinal(sample(1:20))

Isn't it a problem?
> format.cardinal(22)
[1] "22th"

Philippe

> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._