'Creating Large Matrix in R [duplicate]
How can I create a large matrix in R or how can I zip a large matrix into some object?
y <- matrix(rnorm(2e4*2e4),1:20000,1:20000)
Error: cannot allocate vector of size "..." Gb
How is it possible to allocate this matrix?
Solution 1:[1]
I'm not sure why I'm giving this a serious answer but here goes...
1.I can install bigmemory just fine. Perhaps if you are having problems you should share the error message, your environment and OS, and then ask for help on that instead.
2.Perhaps this is just an example:
y <- outer(1:20000,1:20000)
Error: cannot allocate vector of size "..." Gb
but do you really want to do this? Couldn't you refactor your code to iterate/resample a smaller matrix many times or read the data a bit at a time, to wit...
3.Have you considered using RSQlite? It's super easy to install and especially now with the dplyr package is very user friendly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephen Henderson |
