Hi,

I have these lists of genes


    > dim(b)
    [1] 4866    2
    >
How I can extract the small list (bb) from big on by the same order of genes???? I mean the order of genes from extracted file should be the same with small file(bb).
b and bb in OP doesn't share any gene. What is being asked, is not possible when values do not exist (between two data sets). Look at the following example and  see if this is what is required:

    > b=data.frame(genes=paste("gene", sample(10), sep="_"), expn=round(rnorm(10,1,4),2))
    > bb=data.frame(genes=paste("gene",sample(5), sep="_"))
    > b
         genes  expn
    1   gene_6 -0.78
    2  gene_10  4.65
    3   gene_9  1.86
    4   gene_3  2.39
    5   gene_1  0.34
    6   gene_2  2.01
    7   gene_8 -4.51
    8   gene_7 -7.61
    9   gene_5  1.50
    10  gene_4  3.12

    > bb
       genes
    1 gene_2
    2 gene_1
    3 gene_3
    4 gene_4
    5 gene_5

    > b[match(bb$genes,b$genes),]
        genes expn
    6  gene_2 2.01
    5  gene_1 0.34
    4  gene_3 2.39
    10 gene_4 3.12
    9  gene_5 1.50