0

I have been working with almost the same data in R for a couple month and now I suddenly got this error message when I tried to import a dataset I have imported many times before.

What can I do?

I have tried memory.size()and memory.limit(). However, I am not sure that I used it right.

Thank you very much in advance! Anna

  • 1
    Welcome to SO, AnnaLatysheva! I don't know that we can help much knowing nothing about the data, the packages you're using, or the code or processes at work. R generally does a reasonable job of "garbage collection" for memory management; if it's suddenly not working, perhaps `ls.objects()` will clearly show any unused and large data objects you have sitting in your environment. Lacking that, you might try restarting R *without a project or `.Rdata` file* (as that can easily contain the memory-hogging objects). Good luck! – r2evans Feb 24 '21 at 17:07
  • Thank you for involvement! There are different types of data I have this problem with, data from Stata and datasets I made myself in R, which is semicolon separated. I start the program (so there are any other data in environment from last session) and when I try to import data I get this message that R is not able to allocate the vector of some size. I have tried ```ls.objects()```as you said, however it seems like this function does not exist. I am new to R, may be I misunderstood what you ment. – Anna Latysheva Feb 24 '21 at 17:36
  • oops, sorry .... https://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session has some funcs for list objects and their sizes. In fact, that question is very much about managing memory in R. It seems an appropriate read for your dilemma! – r2evans Feb 24 '21 at 17:49
  • One of the answers there is from MattDoyle, one of the authors/contributors to the `data.table` package. I deal with large-ish data (1-4M rows) every day, and when I switched to `data.table`, many things sped up considerably. The learning curve is a little steep, but once you get it, perhaps using that package can help mitigate some memory issues on your end. – r2evans Feb 24 '21 at 17:53

0 Answers0