Re: [R] Compressing String in R

2008-12-24 Thread Stavros Macrakis
Sorry, I meant `[.gene` where gene would be your new class. -s On Wed, Dec 24, 2008 at 11:00 AM, Stavros Macrakis wrote: > You might consider using the 'bit' library and use two bits per base. You > could then wrap this in an object with appropriate functions (bit.`[`, > etc

Re: [R] Compressing String in R

2008-12-24 Thread jim holtman
Since you only have 4 characters, you can can create a table of all the combinations of 4 of them and this will reduce to one byte instead of 4. This is fine if you just want to store them. > x <- expand.grid(c("A","C","G","T"), + c("A", "C", "G", "T"), + c("A", "C", "G", "T"), + c("A

Re: [R] Compressing String in R

2008-12-24 Thread Stavros Macrakis
You might consider using the 'bit' library and use two bits per base. You could then wrap this in an object with appropriate functions (bit.`[`, etc.). -s On Wed, Dec 24, 2008 at 10:26 AM, Gundala Viswanath wrote: > Dear all, > > What's the R way to compress the string into smaller 2

[R] Compressing String in R

2008-12-24 Thread Gundala Viswanath
Dear all, What's the R way to compress the string into smaller 2~3 char/digit length. In particular I want to compress string of length >=30 characters, e.g. ACGATACGGCGACCACCGAGATCTACACTCTTCC The reason I want to do that is because, there are billions of such string I want to print out. And I ne