Dear R experts, code: >m<-read.table("test.txt",sep='\t',header=TRUE,colClasses=c('character','integer','integer','rep('numeric',150)) > s<-data.frame(c(rle(m$Sample1)[[2]],rle(m$Sample2)[[2]],rle(m$Sample3)[[2]]),c(rle(m$Sample1)[[1]],rle(m$Sample2)[[1]],rle(m$Sample3)[[1]])) > names(s)=c("Values","Probes")
#Suppose the test file looks like with ofcourse more samples with values: Chr Start End Sample1 Sample2 Sample3 chr2 9896633 9896683 0 0 0 chr2 9896639 9896690 0 0 0 chr2 14314039 14314098 0 -0.35 0 chr2 14404467 14404502 0 -0.35 0.32 chr2 14421718 14421777 -0.43 -0.35 0.32 chr2 16031710 16031769 -0.43 -0.35 0.32 chr2 16036178 16036237 -0.43 -0.35 0.45 chr2 16048665 16048724 -0.43 -0.35 0.45 chr2 37491676 37491735 0 0 0.45 chr2 37702947 37703009 0 0 0 >s Values Probes 1 0.00 4 2 -0.43 4 3 0.00 2 4 0.00 2 5 -0.35 6 6 0.00 2 7 0.00 3 8 0.32 3 9 0.45 3 10 0.00 1 Here s is nothing but sumarising similiar values with Probes giving the count of similiar values. How to I expand rle function to consider 150 samples here I have just shown for 3 samples other than manually expanding for the rest 147 samples? I have the rest of the code for my purpose just stuck with this step only. waiting for your reply, Thanks, Suji -- View this message in context: http://r.789695.n4.nabble.com/Rle-function-to-expand-for-many-samples-tp3851676p3851676.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.