[R] How to Group Categorical data in R?

priyank
Sat, 17 Mar 2012 21:37:36 -0000

How about this --?

##Assumes you have read your data into data frame "Msg17"

## Capture unique values from data file's Column 3
Col3 <- unique(Msg17$V3)

#Captures length of the unique value vector
LCol3 <- length(Col3)

## Loop to sequentially select rows with the unique Col3 values
for (i in 1:LCol3) {
  print(paste("Column", Col3[i]))
  print(Msg17[Msg17$V3==Col3[i],-3])
}

Good luck!


--
View this message in context: