Hi,

is there a function or an easy way to convert a variable with continuous values 
into a categorial variable (with x levels)?

here is what I mean:


I want to transform x:

x <- c(3.2,  1.5,  6.8,  6.9,  8.5,  9.6,  1.1,  0.6)

into a 'categorial'-variable with four levels so that I get:

[1] 2 2 3 3 4 4 1 1

so each element is converted into its rank- value / categorial-value
(in this example four levels are created).



thanks for any suggestions!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to