Re: [R] Get distribution of positive/negative examples for each cluster

2010-07-21 Thread Phil Spector
Boya- table() is the function that does what you want: cdat = data.frame(membership=rep(1:3,rep(3,3)), + label=as.character(c(0,0,1,0,1,1,1,1,1))) table(cdat) label membership 0 1 1 2 1 2 1 2 3 0 3 From there, you can rearrange it in

[R] Get distribution of positive/negative examples for each cluster

2010-07-21 Thread Boya Sun
Dear R experts, I have a labeled data set. Each data is assigned a binary label 0 or 1. Assume that I use some clustering algorithm to group the data by clusters (using some features of the data). Now I want to know how many data are labeled as 0/1 in each cluster. For example, assume that I have