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

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 20 Mar 1998 09:45:32 +0100


>>>>> "TL" =3D=3D Thomas Lumley <thomas@biostat.washington.edu> writes:

    TL> On Thu, 19 Mar 1998, Martin Maechler wrote:> 
    >> >> This is not a nice name (format is generic; cardinal is not a cla=
ss)
    >> >> for a nice function, which I would like in several places in R co=
de
    >> >> and therefore would like to become part of R (under a better name=
 !)
    >> >> 

    TL> I would have though "ordinal" would be a better name.  Those things
    TL> are called ordinals, not cardinals.
of course.

    TL> This would also allow a language argument to produce

    TL> ordinal(1:3,"english") 
    TL> "1st" "2nd" "3rd"
    TL> ordinal(1:3,"francais")
    TL> "1re" "2me" "3me"
    TL> and so on (we probably have people on R-devel who can supply rules
    TL> for most common languages using the Latin alphabet). 

Excellent!!
I'll adopt these;  
btw,  "deutsch" would be as easy as
=09"1." "2.", .....

    TL> ordinal(1:3,"francais")
    TL> "1re" "2me" "3me"
=09  ^^
=09is this okay, even for males? (premier / premi=E8re)

Maybe, we'd even need an argument "sex" ( or "gender" ?)
to have
=09> ordinal(1:3, "italian", "m")
=09[1] "1o" "2o" "3o"

=09> ordinal(1:3, "italian", "f")
=09[1] "1a" "2a" "3a"
(and same(?) for spanish).


    TL> On the other hand, aren't there GNU internationali{s,z}ation librar=
ies
    TL> that handle this sort of thing?
(called "i18n"), well, yes, in principle.  
I don't know the details, but I think to remember
that these are rather bigger things to be installed on a (Unix) system leve=
l.
=09=
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._