Hi Gurus:
 
If I have a large dataset of the form of:
 
> x <- data.frame(V1 = runif(10), V2 = sample(c('A','B','C'),10,T)) > x         
>  V1 V21  0.2691580  A2  0.8711267  B3  0.2674728  C4  0.3278876  A5  
> 0.1809152  A6  0.2499651  C7  0.9155174  A8  0.8004974  B9  0.7885516  A10 
> 0.9301630  A
And I want a V3 that =V2 if V2=A, and =D if V2=B or C. In other words I want to 
use a vectorized way to combine some levels, rather than having to loop through 
a large dataset.
 
Similarly, if I want to group V1 into levels, what is a fast way to do it?
 
Thank you!
Karen
_________________________________________________________________
If you like crossword puzzles, then you'll love Flexicon, a game which 
comb[[elided Hotmail spam]]

        [[alternative HTML version deleted]]

______________________________________________
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