This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Add Matrix With Clinical Data To Expression Matrix

Hi,

I have two objects:

1) An expression matrix -allData - contains 949 rows, the first column is the arrayID

2) A matrix with clinical data-clinicalChar also 949 rows, and the first column is the arrayID,

The first column(arrayIDs) of both match up to each other, so i just need to add it. I need to add the clinical data matrix ot the allData matrix, how can I do this ?

Thanks for the help, R

bioconductor microarray r matrix

You REALLY want to be using ExpressionSets for storing clinical data alongside genomic data such as expression data. See the vignette from the Biobase package for details.

1 answer

If both allData and clinicalChar are sorted on arrayID, then just cbind:

allData_new <- cbind(allData,clinicalChar)

If not sorted, then merge:

allData_new <- merge(allData, clinicalChar, by="arrayID")

Log in to answer this question.