Sometimes R users get the out-of-memory error; to solve that, we can increase the memory in R. This tutorial demonstrates how to increase the memory in R.
There are two methods to increase the memory in R; one is manual, and the other is a method.
Increase Memory Manually in R
Windows users mostly get out-of-memory errors. We can increase the memory of R from the properties of the R program or app.
Follow the steps below if you are using Windows.
Right-click on the R program icon from the desktop or the program directory and go to
Go to the
Shortcuttab and find the
Add the following line into the
The code above will allocate 1000 MB of memory to the R program; the maximum can be the memory up to the memory of R.
OK, and you are good to go.
There might be an error that R cannot allocate the vector of length. Then add the following line to the
Targetfield and click
Increase Memory by the
memory.limit() Method in R
memory.limit() can allocate memory to an R program. It takes one parameter
size in MBs.
Let’s try an example.
The code above will allocate the 1000 MB memory to the R program.