jeudi 18 avril 2019

What function should I use to return a vector of characters?

So I have a data set that looks like this:

  gene_id gene_symbol Chr        Biotype     L001P    L003P    L004P    L005P    L008P    L010P    L012P    L014P     L016P    L017P
2  ENSG00000000003      TSPAN6   X protein_coding   31.8003  67.3098   63.033    63.83  38.6941  37.4997  39.0373  31.1002   23.7469  28.9765
3  ENSG00000000005        TNMD   X protein_coding 0.0372353  2.28841 0.032932        0 0.358512        0 0.611116        0 0.0345605        0
4  ENSG00000000419        DPM1  20 protein_coding   17.5575  43.7474  21.0119  22.9765  26.3166  23.1935  21.2541  16.1137   22.1183  13.4906
5  ENSG00000000457       SCYL3   1 protein_coding   2.68196   3.7079  3.14505  3.82323  3.32028  4.07531  3.33656  3.25582   3.40544  3.85669
6  ENSG00000000460    C1orf112   1 protein_coding  0.532179  2.46598  1.11985 0.584227  1.20095  1.05804  1.10271  1.61936   1.14899  1.74481

I need to return the gene_symbol for each gene that has an sd > mean. So far I have this (where x is the df and z is a subset of data that I'm looking at):

VGenes <- function(x,z){
  stdev <- apply(z, 1, sd)
  avg <- apply(z, 1, mean)
  if(stdev > avg){

  }
}

I want something that looks like this: [1] "TSPAN6" "DPM1" "SCYL3" etc..

Thanks!

Aucun commentaire:

Enregistrer un commentaire