Skip to content
Prev 278113 / 398502 Next

R ignores number only with a nine under 10000

Hi:

Strictly a guess, but the following might be helpful. The call below
assumes that the referent data frame is test1, which consists of a
single column named x. Modify as appropriate.

test_lab <- with(test1, cut(x, c(0, 18954, 37791, 56951, 75944, 84885, 113835),
                 labels = c('I8456', 'ref', 'Cyprus1', 'KE3870', 'KE3873',
                            'KE3926OT')))

cut() creates a factor from a numeric variable. The second argument
consists of the cut points and the third argument generates the labels
to be associated with values falling between the cut points. See ?cut
for more details, and pay attention to the options.

The object test_lab is a vector external to test1; if you want it to
be a column of test1, then add it to the data frame in one of the
usual ways.

HTH,
Dennis
On Mon, Nov 21, 2011 at 7:42 AM, set <astareh at hotmail.com> wrote: