From Friedrich.Leisch@ci.tuwien.ac.at  Thu Mar 19 11:25:13 1998
From: Friedrich.Leisch@ci.tuwien.ac.at (Friedrich Leisch)
Date: Thu, 19 Mar 1998 12:25:13 +0100
Subject: a handy function "format.cardinal", looking for a proper name..
In-Reply-To: <199803191121.MAA07944@sophie.ethz.ch>
References: <Pine.OSF.3.96.980319121016.15933F-100000@alpha>
 <199803191121.MAA07944@sophie.ethz.ch>
Message-ID: <199803191125.MAA22321@galadriel.ci.tuwien.ac.at>

>>>>> On Thu, 19 Mar 1998 12:21:39 +0100,
>>>>> Martin Maechler (MM) wrote:

>>>>> "Philippe" == Philippe Lambert <phlamber@luc.ac.be> writes:

Philippe> 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))

Philippe> Isn't it a problem?
MM> Oh yes, course!
>>> format.cardinal(22)
Philippe> [1] "22th"

MM> Thank you Philippe!

MM> So, the function will become a bit more complicated.
MM> The following would be better, but is not yet the solution
MM> [and yes, I must consult an English dictionnary or such...].
                                              ^^

is probably a good idea :-)

.f
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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