[R] change factor level 1,2,3 to red,blue,dark

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Dec 7 12:10:38 CET 2006



Aimin Yan wrote:
> I am new to R. Maybe this is very simple question.
> I have a dataframe, there is column that is factor.
> This factor has three level that 1,2,3.
> Now I want to change these  level(1,2,3) to level(red,blue,dark).
> Does anybody how to do this job?


levels(dataframe$column) <- c("red", "blue", "dark")

Uwe Ligges

> Thank you very much
> 
> Aimin
> 
> ______________________________________________
> 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