[R] Classification

John Kane jrkrideau at yahoo.ca
Wed Jul 18 19:52:05 CEST 2007


Have a look at the recode function in the car package

library(car)
?recode
 should give you what you need.


--- "Ing. Michal Kneifl, Ph.D." <xkneifl at mendelu.cz>
wrote:

> Hi,
> I am also a quite new user of R and would like to
> ask you for help:
> I have a data frame where all columns are numeric
> variables. My aim is  
> to convert one columnt in factors.
> Example:
> MD
> 0.2
> 0.1
> 0.8
> 0.3
> 0.7
> 0.6
> 0.01
> 0.2
> 0.5
> 1
> 1
> 
> 
> I want to make classes:
> 0-0.2 A
> 0.21-0.4 B
> 0.41-0.6 C
> ..... and so on
> 
> So after classification I wil get:
> MD
> A
> A
> D
> B
> .
> .
> .
> and so on
> 
> Please could you give an advice to a newbie?
> Thanks a lot in advance..
> 
> Michael
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list