[R] T2 hoteling
Jim Lemon
jim at bitwrit.com.au
Sun Dec 26 23:03:08 CET 2010
On 12/27/2010 12:43 AM, leyla khodakarim wrote:
> Dear All
>
> It is very kind of you to guide me.
>
> When I want to run this line, I see this error
>
> stat.obs<- apply(GS, 2, function(z) Hott2(t(DATA[which(z==1),]), cl))
>
> Error in colSums(w * x) : 'x' must be an array of at least two dimensions
>
> cl<- as.factor(y)
>
> GS: a matrix with 0 or 1
>
> GS: gene sets
>
> -> a data matrix with rows=genes,
>
> columns= gene sets,
>
> GS[i,j]=1 if gene i in gene set j
>
> GS[i,j]=0 otherwise
>
> Hott2<- function(x, y, var.equal=TRUE) #T2 hoteling
>
> Y<- c(1,0,0,0,0,0,1,1,0,0,1,0,1,1,1,1,0,1,0,1)
>
> Data=transpose(X)= gene expression: row=40 gene, column=10 sample
>
> Data: there is in attachment file
>
Hi Leyla,
Your attachment didn't make it to the list, but the problem may be that
which(z==1) reduces the matrix (array? data frame?) X to a vector. One
other thing that looks funny is the capitalization. In R, X and x are
different, as are DATA and Data. First thing is to just print out the
data you are trying to analyze:
DATA[which(z==1)]
and see if it really is an array with at least two dimensions.
Jim
More information about the R-help
mailing list