[R] How to create a vector with "one", "two", "three", ...?

Marc Schwartz MSchwartz at MedAnalytics.com
Sun Apr 17 00:24:05 CEST 2005


I may be wrong, but I am unaware of anyone that has created a number to
text function in R.

If you search Google:

http://www.google.com/search?q=numbers+into+words

There are various program examples, from VB to JavaScript to PHP, etc.

It shouldn't be too hard to convert one of them to R. Most have fairly
common constructs in terms of parsing and converting the numbers. Some
of them handle decimals and currency formats as well.

HTH,

Marc Schwartz


On Sat, 2005-04-16 at 18:01 -0400, Frank Duan wrote:
> Sorry, I didn't get the question clear. What I meant is to create a
> character vector with length 200:
> "one", "two", "three", ..., "two hundred"
> 
> On 4/15/05, Federico Calboli <f.calboli at imperial.ac.uk> wrote:
> > On Fri, 2005-04-15 at 14:30 -0400, Frank Duan wrote:
> > > Hi R people,
> > >
> > > I met a naive prolem. Could anyone give me a hint how to create such a
> > > vector with entries: "one", "two", "three", ...?
> > 
> > rvect <- c("one", "two", "three")
> > rvect
> > [1] "one"   "two"   "three"
> > 
> > Is it what you want?
> > 
> > F




More information about the R-help mailing list