R: Memory

From MathWiki

Some functions to help work with memory:

  • object.size
  • memory.limit
  • memory.size

Look at:

  •  ?Memory
  •  ?Memory-limits


  • When using nlme (and perhaps lmer), with a large data frame that has a lot of unneeded variables, consider dropping unnecessary variables since the entire data frame with all its variables is saved as a component of the fit. Easy way would be:
 > smallerdata <- model.frame( ~ y + fixed.formula + random.formula + id, bigdata)

where 'y', 'fixed.formula', 'random.formula' and 'id' represent the name of the response, the fixed effects formula, etc.

  • When recording graphs, previous graphs are stored in an object called '.SavedPlots' which can get very large. Try:
 > object.size(.SavedPlots) 

to have a look. If it's very large consider deleting it.