Dear R people. I´m facing a big problem. I need to create a matrix with 10.000 columns and 750.000 rows. matrix<- as.data.frame(matrix(data=0L, nrow=750000, ncol=10000) as you can see, the data frame has huge dimesions. I was able to find out about thr "L" in data, this way I´m telling that my data is "integer" class. By doing this object.size(matrix) tells me that this is half of the matrix when I don´t define as integer (L) The data that I´ll be filling with my matrix will be 0 and 1, nothing else, so I could use less bytes. so, my cuestion is, How can I create the same matrix but using even less bytes? I´ll appreciate if you can help me. Thank you. Lucas [[alternative HTML version deleted]]
See ?sparseMatrix from package Matrix. Eloi On 12-05-07 02:23 PM, Lucas wrote:> Dear R people. > I´m facing a big problem. > I need to create a matrix with 10.000 columns and 750.000 rows. > matrix<- as.data.frame(matrix(data=0L, nrow=750000, ncol=10000) > as you can see, the data frame has huge dimesions. I was able to find out > about thr "L" in data, this way I´m telling that my data is "integer" > class. By doing this > object.size(matrix) tells me that this is half of the matrix when I don´t > define as integer (L) > The data that I´ll be filling with my matrix will be 0 and 1, nothing else, > so I could use less bytes. > so, my cuestion is, How can I create the same matrix but using even less > bytes? > > I´ll appreciate if you can help me. > > Thank you. > Lucas > > [[alternative HTML version deleted]] > > > > ______________________________________________ > R-help@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.-- Eloi Mercier Bioinformatics PhD Student, UBC Paul Pavlidis Lab 2185 East Mall University of British Columbia Vancouver BC V6T1Z4 [[alternative HTML version deleted]]
If all you want are binary 0/1, then look at the 'bit' package which will let you create a vector of bits. Even for your matrix, you will need almost 1GB of memory to store a copy. On Mon, May 7, 2012 at 5:23 PM, Lucas <lpchaparrovio at gmail.com> wrote:> Dear R people. > I? facing a big problem. > I need to create a matrix with 10.000 columns and 750.000 rows. > matrix<- as.data.frame(matrix(data=0L, nrow=750000, ncol=10000) > as you can see, the data frame has huge dimesions. I was able to find out > about thr "L" in data, this way I? telling that my data is "integer" > class. By doing this > object.size(matrix) tells me that this is half of the matrix when I don? > define as integer (L) > The data that I?l be filling with my matrix will be 0 and 1, nothing else, > so I could use less bytes. > so, my cuestion is, How can I create the same matrix but using even less > bytes? > > I?l appreciate if you can help me. > > Thank you. > Lucas > > ? ? ? ?[[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? Tell me what you want to do, not how you want to do it.