Re: [R] select groups

2014-02-11 Thread arun
Hi, Try: row.names(res) <- gsub(".*\\.","",row.names(res))  row.names(res)[1:2] #[1] "23" "2" A.K. Thank you very much. But it's possible have the inicial number of the row without a.23, but only 23, for example? It's important to know which row I had select. Thank you very much for yo

Re: [R] select groups

2014-02-11 Thread arun
Hi, Try: set.seed(42)  dat <-as.data.frame(matrix(sample(20:100,4*45,replace=TRUE),ncol=4)) set.seed(345)  dat <- within(dat,class1 <- sample(letters[1:3],45,replace=TRUE) )  table(dat$class1)*0.4 # #  a   b   c #6.0 4.8 7.2 set.seed(85) res <- do.call(rbind,lapply(split(dat,dat$class1),function