This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieving values specific to a column

How to retrieve values specific to a column in comparison to other columns.

Say , there is a matrix of a dimension 10*3

   a1 a1.1 a1.2
1   A   A1   A2
2   B   B1   B3
3   C   C1   C4
4   D   D1   D6
5   E    E    E
6   F    F    F
7   G    G    G
8   H    H    H
9   I    I    I
10  J    J    J

And, I would like to get values specific to column. values which are common in more than one column need to be removed.Some thing like this

   a1 a1.1 a1.2
1   A   A1   A2
2   B   B1   B3
3   C   C1   C4
4   D   D1   D6

Is there any function in R to retrieve values specific to a column in comparison to other column?

r column-specific

Hello Sathya!

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

As written, this is just an R question and has nothing to do with bioinformatics. If you update it to make it relevant to the site then it'll be reopend.

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!

1 answer

If you want rows that have the same value in each column to be removed use:

remove.rows <- apply(yourMatrix,1,function(x){length(unique(x)) == 1})

yourNewMatrix <- yourMatrix[!remove.rows,]

Log in to answer this question.