Problem#################################################################

I am having a problem combining a matrix and elements of a list into one data
frame.

Data####################################################################

The matrix is ludwig.results and dim of matrix is 213,8.

The list is called symbols and its length is 213.  

Following is an example the structure of my matrix (ludwig.results): 

 

     Row    Gene ID      Gene Name Score(d)           Numerator(r)
Denominator(s+s0)    Fold Change        q-value(%)        

[1,] "9507" "1427276_at" "9506"    "4.60382496146004" "0.418481878487541"
"0.0908987378952882" "1.33515425467743" "4.80974775545105"

[2,] "8927" "1426653_at" "8926"    "4.45317231159082" "0.319591808000491"
"0.0717672224738867" "1.24728944266546" "4.80974775545105"

 

The list symbols has been generated from the aanaffy package. Following is an
example of the list (symbols) :

 

[[1]]

[1] "Smc4"

attr(,"class")

[1] "aafSymbol"

 

[[2]]

[1] "Mcm3"

attr(,"class")

[1] "aafSymbol"

 

attr(,"class")

[1] "aafList"

 

I want to combine the data in the matrix with the corresponding gene symbols
in the list symbols. The order in which the gene symbols are stored in
symbols

is the same as the order in the matrix.

 

Currently the code I have written is as follows:

 

for (i in 1:length(symbols)){

     temp.results[i]<- cbind(ludwig.results[i],symbols[[i]])

    new.results<-rbind(new.results,temp.results[i])

           }

I get the following error using this code:

 

Error in `[<-.data.frame`(`*tmp*`, i, value = c("9507", "Smc4")) : 

        replacement has 1 rows, data has 0

 

Can someone suggest me how to correct this code and get the desired results.

 

This is the format I want it to be.

 

Row              Gene ID            Gene Name             Score(d)
Numerator(r)    Denominator(s+s0)          Fold Change           q-value(%)
symbol

  "9507"         "1427276_at"               "9506"   "4.60382496146004"
"0.418481878487541" "0.0908987378952882"   "1.33515425467743"
"4.80974775545105"  "Smc4"

  "8927"         "1426653_at"               "8926"   "4.45317231159082"
"0.319591808000491" "0.0717672224738867"   "1.24728944266546"
"4.80974775545105"  "Mcm3"

 

 

 

Thanks in advance.

 

Manisha

 


	[[alternative HTML version deleted]]


