This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R Two matrices, extract rows based on common column

Hello,

My question is about matrixes for R. I have two matrices r and m:

m <- as.matrix(read.table(text="
15 56 44 1 4 7
61 31 63 7 1 3
10 36 99 5 9 6
65 79 88 54 1 1"))
colnames(m) <- c("Z","Q","A","F","D","H")
r <- as.matrix(read.table(text="
15 56 64
10 36 61 "))
colnames(r) <- c("Z","L","O")

I want to extract the rows based on common column (in this case Z column), so the result would be

A
15 56 44 1 4 7
10 36 99 5 9 6

A is the new matrix.

Any Ideas how to ?

extract r matrices column

Hello martinkara7!

We believe that this post is does not fit the main topic of this site.

This is just an R question and has nothing to do with bioinformatics. Update the question to make it relevant and it'll be reopened.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.