Re: [R] FOR loop with statistical analysis for microarray data

2011-10-27 Thread Weidong Gu
Looks like you have problems with indexing. In your code, fc is a vector of length 2, pv is a scalar(it only keeps the last value of the loop), then you try to cbind different lengths of vectors (row.names(y1), fc and pv). cbind only works for vectors with the same length. I don't know what you wa

Re: [R] FOR loop with statistical analysis for microarray data

2011-10-27 Thread Seb
thanks for the replies so, i remove the indices pv[i] and fc[i]..but when i run it like this: === fc=0 pv=0 for (i in 1:nrow(data)) { v1= c(y1[i,1], y1[i,2]) v2= c(y2[i,1], y2[1,2]) fc=v1-v2 w=t.test(v1,v2) pv=w$p.value } results =

Re: [R] FOR loop with statistical analysis for microarray data

2011-10-27 Thread Weidong Gu
In your loop, you assign, for example, pv twice pv=w$p.value # pv is scalar pv[i]= w[2] # pv is a vector give an example for the point pv=1 pv[5]=2 pv [1] 1 NA NA NA 2 This may not be what you want. Weidong On Thu, Oct 27, 2011 at 7:40 AM, Seb wrote: > y1,y2 were designed as follow,from t

Re: [R] FOR loop with statistical analysis for microarray data

2011-10-27 Thread Seb
y1,y2 were designed as follow,from the original data file : y1=data[,1:2] y2=data[,3:4] ...I am a bit confused with what "redesign the whole vector again" and "specify indices twice " actually mean?...could u point it out in the script? Thanks so much I really appreciate it!! Sent from my -DROID

Re: [R] FOR loop with statistical analysis for microarray data

2011-10-26 Thread Weidong Gu
If you provide an example data (y1 and y2 in the loop), you might have got specific helps already. A few things in your loop seem suspicious. fc and pv are vectors, and in each loop you redesigned the whole vectors and specific indices twice. That may cause your problems. Weidong Gu On Wed, Oct

Re: [R] FOR loop with statistical analysis for microarray data

2011-10-26 Thread David Winsemius
"affy" is a bioconductor package. You should be asking this question on the bioc mailing list. -- David. On Oct 26, 2011, at 4:56 PM, Seb wrote: hi all i started recently using R and i found myself stuck when i try to analyze microarray data. i use the "affy" package to obtain the intensit