[R] For column values-Quality control

Bansal, Vikas vikas.bansal at kcl.ac.uk
Sat Jul 9 00:09:44 CEST 2011


Dear all,

I am really sorry for not giving the input file because in my mail,I did not explain my problem in a best way.

I have a file that is summary.txt(I have attached it) .we can read this file using-

dfa=read.table("summar.txt",fill=T,colClasses = "character",header=T)

 In V10 column I have  ASCII values which I converted into decimal numbers using this code-

dfa$V10=lapply(dfa[,4], function(c) as.numeric(charToRaw(c)))

Now I have a dataframe dfa with these columns something like this-

V7 V8             V9                                                       V10
  0  1              G                                                        82
  0  1              CGT                                             c(90, 92, 96)
  0  1              GA                                                 c(78, 92)
  0  1              GAG                                             c(90, 92, 92)
  0  1              G                                                        88
  0  1              A                                                        96
  0  1              ATT                                             c(90, 96, 92)
  0  1              T                                                        94
  0  1              C                                                        97

the values in column V10 corresponds to A,C,G T in column V9.I want only those whose score is more than 91.so output of above should be-

V7 V8             V9                                                       V10
  0  1              GT                                             c(90, 92, 96)
  0  1              A                                                 c(78, 92)
  0  1              AG                                             c(90, 92, 92)
  0  1              A                                                        96
  0  1              TT                                             c(90, 96, 92)
  0  1              T                                                        94
  0  1              C                                                        97

Can you please tell me the solution.




Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
________________________________________
From: Bansal, Vikas
Sent: Friday, July 08, 2011 9:15 PM
To: r-help at r-project.org; dwinsemius at comcast.net
Subject: For column values-Quality control

Dear sir,

I am struggling with a problem.Please help me.
Now I have a dataframe with these columns-

V7 V8             V9                                                       V10
  0  1              G                                                        82
  0  1              CGT                                             c(90, 92, 96)
  0  1              GA                                                 c(78, 92)
  0  1              GAG                                             c(90, 92, 92)
  0  1              G                                                        88
  0  1              A                                                        96
  0  1              ATT                                             c(90, 96, 92)
  0  1              T                                                        94
  0  1              C                                                        97

the values in column V10 corresponds to A,C,G T in column V9.I want only those whose score is more than 91.so output of above should be-

V7 V8             V9                                                       V10
  0  1              GT                                             c(90, 92, 96)
  0  1              A                                                 c(78, 92)
  0  1              AG                                             c(90, 92, 92)
  0  1              A                                                        96
  0  1              TT                                             c(90, 96, 92)
  0  1              T                                                        94
  0  1              C                                                        97

Can you please tell me the solution.





Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London



More information about the R-help mailing list