[R] problem reading file containing bit vector

jim holtman jholtman at gmail.com
Mon Jan 31 01:20:39 CET 2011


I think you want to make sure you read it is as character:

> x <- read.table(textConnection('"swissProtID"    "entrezID"    "bitVec"
+ "Q62924"             "---"    "00000000100010000000000000000000"
+ "P18897"             "---"    "00000000000001000100000000000000"
+ "Q62736"             "---"    "00001000001000000000001000000000"
+ "P13589"             "---"    "00100000010000010000000000000000"')
+     , colClasses = rep('character', 3)
+     , as.is = TRUE
+     , header = TRUE
+     )
> closeAllConnections()
>
> x
  swissProtID entrezID                           bitVec
1      Q62924      --- 00000000100010000000000000000000
2      P18897      --- 00000000000001000100000000000000
3      Q62736      --- 00001000001000000000001000000000
4      P13589      --- 00100000010000010000000000000000
> str(x)
'data.frame':   4 obs. of  3 variables:
 $ swissProtID: chr  "Q62924" "P18897" "Q62736" "P13589"
 $ entrezID   : chr  "---" "---" "---" "---"
 $ bitVec     : chr  "00000000100010000000000000000000"
"00000000000001000100000000000000" "00001000001000000000001000000000"
"00100000010000010000000000000000"
>


On Sun, Jan 30, 2011 at 12:22 PM, Fahim M <fahim.md at gmail.com> wrote:
> Hi I have a tab delimited file with fillowing content:
>
> "swissProtID"    "entrezID"    "bitVec"
> "Q62924"             "---"    "00000000100010000000000000000000"
> "P18897"             "---"    "00000000000001000100000000000000"
> "Q62736"             "---"    "00001000001000000000001000000000"
> "P13589"             "---"    "00100000010000010000000000000000"
>
> When I read this the bitVec field is not read properly. Instead, the value
> showing is "Inf" .
> How should i read this file?  as.is/colclasses field in read function is not
> helping me.
>
> Is there any package that can do bitwise operation(and/or) on bitVectors.
> bitops seems to do that but I need output in bitvector format only.
> Thanks
> Fahim
>
>
> --
> Fahim Mohammad
> Bioinforformatics Lab
> University of Louisville
> Louisville, KY, USA
> Ph:  +1-502-409-1167
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list