Re: [R] Help to find only one class and differennt class

2005-12-21 Thread Muhammad Subianto
Thanks to Jim Holtman. This is very usefull to improve my script. Best, Muhammad Subianto On this day 20/12/2005 17:19, jim holtman wrote: >try this: > >set.seed(1) ># generate some test data >x.1 <- data.frame(seg=sample(1:6,20,T), class=sample(c('good', >'poor'),20,T)) >x.1 >(x.sp <- split(x.1,

Re: [R] Help to find only one class and differennt class

2005-12-20 Thread jim holtman
try this: set.seed(1) # generate some test data x.1 <- data.frame(seg=sample(1:6,20,T), class=sample(c('good', 'poor'),20,T)) x.1 (x.sp <- split(x.1, x.1$seg)) # test each segment for occurance of class. lapply(x.sp, function(.seg){ if (all(.seg$class == 'good')) return('good') if (all(.se

[R] Help to find only one class and differennt class

2005-12-20 Thread Muhammad Subianto
Dear R users, I have a problem, which I can not find a solution. Probably someone could help me? I have a result from my classification, like this > credit.toy [[1]] age married ownhouse income gender class 1 20-30 no nolow male good 2 40-50 no yes medium female