[R] Regarding categorization or grouping of data

Andrew Athan aathan_R_1542 at memeplex.com
Tue Mar 7 20:20:28 CET 2006


Could someone please provide a examples regarding "best practice" for 
grouping and/or categorization of data?

E.g., if I have a data page with columns X,CAT where CAT is an integer 
1-10, and I want to create a new data page where for each value of CAT I 
have the sum(X)?
E.g., I have same X,Y,CAT and I want to split this up into several sets 
according to CAT,
E.g., I want to plot each set of X,Y per CAT using a different color for 
each CAT ... perhaps on the same graph?


I have generally solved these problems by massaging the data e.g., for 
X,Y,CAT case .... data[data$CAT=1,c(1,2)] gives me X,Y for CAT=1, etc. 
but this seems like a kludge, especially since I have to loop through 
each unique value of CAT ...

Thanks,
A.




More information about the R-help mailing list