0

This is my sample dataframe

        ENSEMBL  n
1  ENSG00000174738  4
2  ENSG00000150907  6
3  ENSG00000207205  2
4  ENSG00000196159  2
5  ENSG00000085276 17
6  ENSG00000128045  2
7  ENSG00000264056  2
8  ENSG00000237128  1
9  ENSG00000135083  2
10 ENSG00000057294  2

So if i do see the no of unique n in my dataframe

cddd <- as.data.frame(unique(bbbbb$n))

This gives me this

dim(cddd)
[1] 18  1
> cddd
   unique(bbbbb$n)
1                4
2                6
3                2
4               17
5                1
6                3
7                5
8                8
9                7
10               9
11              12
12              14
13              13
14              10
15              15
16              11
17              22
18              16

So my objective is to find those rows which match these element in the last column of my data frame.

My final sample output I want to see is like this if n=2 the I would like to see

ENSEMBL         n 
ENSG00000057294 2
ENSG00000207205 2
ENSG00000135083 2
ENSG00000264056 2
ENSG00000128045 2

Similarly for if it matches 4 or 6 or any other unique elements in my last column then it should be created another data-frame with respective ENSEMBL and their n

PesKchan
  • 868
  • 6
  • 14

0 Answers0