[R] categorization

Ista Zahn istazahn at gmail.com
Mon Nov 9 20:20:16 CET 2009


I don't know if it's "the fastest" way, but you can get there with

as.character(factor(exData$Condition, levels=c("c20", "c10", "c9",
"c5"), labels=c("AA", "BB", "CC", "DD")))

-Ista

On Mon, Nov 9, 2009 at 2:06 PM, phoebe kong <sityeekong at gmail.com> wrote:
> Hi All,
>
> I have a dataset with a column named "Condition",
>
>
> Sample   Condition
> 1            c20
> 2            c20
> 3            c10
> 4            c10
> 5            c9
> 6            c9
> 7            c5
> 8            c5
> 9            c20
> 10          c10
>
> Could you let me know the fastest way to change c20->"AA", c20->"BB",
> c9->"CC", c5->"DD" without using for loop?
>
> Thanks
> phoebe
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org




More information about the R-help mailing list