Based on a t-test on gene expression data from microarray (with the EMA package) and subsequent annotation I generated a data frame that looks like this:
>
head(rt.annot)
affy_hg_u133_plus_2 probeID Stat RawpValue AdjpValue entrezgene hgnc_symbol ensembl_gene_id
14744 204103_at 204103_at 11.754856 1.718688e-20 9.396926e-16 6351 CCL4 ENSG00000275302
721 1553177_at 1553177_at 10.358405 1.810027e-17 4.948161e-13 117157 SH2D1B ENSG00000198574
16279 205495_s_at 205495_s_at 9.909715 1.721748e-16 3.137886e-12 10578 GNLY ENSG00000115523
21763 210163_at 210163_at 9.496225 1.374429e-15 1.623589e-11 NA <NA> <NA>
44641 230464_at 230464_at 9.480850 1.484763e-15 1.623589e-11 53637 S1PR5 ENSG00000180739
18998 207840_at 207840_at 9.383745 2.417818e-15 1.652428e-11 11126 CD160 ENSG00000117281
with 60376 rows and 8 columns.
I also measured the fold change of gene expression between the 2 groups, this generated a vector:
> head(fcOUT)
1007_s_at 1053_at 117_at 121_at 1255_g_at 1294_at
0.9436815 1.0098279 1.0230719 0.9826041 0.9917645 1.0906764
How do I merge the data frame (rt.annot) and vector (fcOUT) (so that the vector is aligned as a column to the matrix, based on the first column aafy_hg_u133_plus_2 (thus not as cbind function))? I could not find the answer elsewhere.
Thank you!
Did you try merge?
a <- c("c1", "c2", "c3")
x <- 1:3
y <- runif(3)
foo <- data.frame(a = a, x = x)
bar <- data.frame(a = a, y = y)
merge(foo, bar, by = "a")
Also, please read this, and make your examples minimal and reproducible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With