Skip to content
Prev 307446 / 398506 Next

How to create a column in dependence of another column

It might be simpler to use cut():
   > trans_value <- c(3000, 200, 400, 50, 2000)
   > cut(trans_value, breaks=c(-Inf, 200, 500, Inf), labels=c("low","medium","high"))
   [1] high   low    medium low    high
   Levels: low medium high

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com