Re: [R] Need some suggestions for outlier detection in a matrix

2014-01-15 Thread arun
Hi, Try: dat1 - read.table(ZvsPGRT_frag_0filt.txt,sep=\t,header=TRUE,row.names=1) dat_Z - dat1[,1:4] ## unnecessary to do cbind() here mat1 - as.matrix(dat_Z)  head(mat1,2) #    Sample_118z.0 Sample_132z.0 Sample_141z.0 Sample_183z.0 #XLOC_01   626  3516  1277   

Re: [R] Need some suggestions for outlier detection in a matrix

2014-01-15 Thread arun
Also, If you need the 'position' of the outlier in each row: Position - apply(!(mat1 -ctest_mat1[,1]),1,function(x) if(length(which(x))1) NA else which(x)) mat3 - cbind(mat2,Position) A.K. On Wednesday, January 15, 2014 11:33 AM, arun smartpink...@yahoo.com wrote: Hi, Try: dat1 -

Re: [R] Need some suggestions for outlier detection in a matrix

2014-01-15 Thread arun
Hi Vivek, chisq.out.test(as.numeric(mat1[1,]))$alternative #[1] highest value 3516 is an outlier as.numeric(gsub([[:alpha:]],,chisq.out.test(as.numeric(mat1[1,]))$alternative)) #[1] 3516 #removes the alphabetic characters so that only number remain. Also, remember that it is just the