[R] Large loops in R

R. Michael Weylandt michael.weylandt at gmail.com
Tue Dec 4 21:19:37 CET 2012


On Tue, Dec 4, 2012 at 8:14 PM, Charles Novaes de Santana
<charles.santana at gmail.com> wrote:
> "Error in matrix(0, 48000, 48000) : too many elements specified"
>
> but I thought it was a machine limitation (and I was asking for access
> to a better machine in my labs...). Thanks for clarifying it.
>
> Well, when Sarah gave me the answer for my problem, I got a new one :)
> Thank you, Sarah and Peter.
>
> So, is there any other way to "trick R" and allocate such large matrices?
>

Either

1) Use the development version of R which has large-vector support
(matrices are vectors under the hood)

or

2) A large matrix is usually sparse in structure: use one of the many
sparse representation packages (e.g., Matrix) available.

MW




More information about the R-help mailing list