I am running a function along a genetic string (such as CCAGTAATTA). At each letter my function computes an integer. So for the string above, there are 10 letters and I get a vector with 10 integers.
For chromosome 1, there are 195 million letters, so I get a very long vector. However, while the sequence only takes up 186.4Mb of memory, the vector takes over 1.5GB.
I have two questions:
Is there a more efficient way to store the integers? I need 195 million integers in some format.
Is there a method for writing it to a file? I have tried write.csv, but it crashes due to the size.