[R] Continuous variable into levels
Neha gupta
neh@@bo|ogn@90 @end|ng |rom gm@||@com
Thu Mar 3 22:01:29 CET 2022
Hello everyone
I have a variable with about 5000 different values
var1= c(0, 123, 400, .....4988)
I want to convert it into different levels for some comparisons like
if value is between 1-100 do something
else
do other things
Is there any sophisticated way to do that than the following:
var2=cut(var1, br=c(-1,500, 501,1000, 1001,5000))
Thank you
[[alternative HTML version deleted]]
More information about the R-help
mailing list