[R] How to Group Categorical data in R?

priyank priyank.tripathi at gmail.com
Sat Mar 17 22:37:36 CET 2012


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: http://r.789695.n4.nabble.com/How-to-Group-Categorical-data-in-R-tp4477622p4481247.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list