Question: (Closed) Retrieving values specific to a column
0
gravatar for Sathya
4.9 years ago by
Sathya30
India
Sathya30 wrote:

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 ?

 

column specific R • 1.1k views
ADD COMMENTlink modified 4.9 years ago by Irsan6.8k • written 4.9 years ago by Sathya30

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!

ADD REPLYlink written 4.9 years ago by Devon Ryan89k
0
gravatar for Irsan
4.9 years ago by
Irsan6.8k
Amsterdam
Irsan6.8k wrote:

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,]

ADD COMMENTlink modified 4.9 years ago • written 4.9 years ago by Irsan6.8k

Thanks Irsan

ADD REPLYlink written 4.9 years ago by Sathya30
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 789 users visited in the last hour