Size Limit unable to create plots

Due to size limit, I cannot form plots on rstudio.


Do I modify my code? It cannot form any plot. I get the same notification of size limit.
This the line of code:

avg_users <- edx %>%
left_join(avg_movie_rating, by='movieId') %>%
group_by(userId) %>%
filter(n() >= 100) %>%
summarize(b_u = mean(rating - mu - b_i))
avg_users %>% qplot(b_u, geom ="histogram", bins = 30, data = ., color = I("grey"))

Try running the code in a fresh session in the first instance. Sometimes memory is not released when you have created many objects.

This is going to sound stupid but just pull the plot area open a bit more. It's worked for me a couple of times.

could you offer a guess as to why adjust the plot display avoids an apparent out of memory when creating vector issue ? its cool that you had the solution but just wondering ... why ?!

1 Like

I tried this with the plots, it's working. But it isn't with this code. I keep getting the same error:

avg_users <- edx %>%
left_join(avg_movie_rating, by = 'movieId') %>%
group_by(userId) %>%
filter(n() >= 100) %>%
summarize(b_u = mean(rating - mu - b_i))
Error: cannot allocate vector of size 52.9 Mb

I also tried maximizing the screen like you said but it's not working.

I have not the faintest idea. I stumbled on it by accident a few months ago when I got the error message and on checking found that if I ran R from the command line, plotting worked fine.

how much RAM is available to your system?
I would use


to see how much memory is in use by R at the point where you run out of memory.
pryr::object_size() can tell you the memory used up by any R object in your session.
If you have big objects you no longer need then release them by setting them to null or rm() removing them

It looks like nirgrahamuk's questions about memory makes sense or perhaps have a look at ?"Memory-limits"

Is your data set publicly available or could you post a dput() format sample of the data here? Without knowing the format of the data it is difficult to make suggestions.

I have been trying to do that since last week. I get the same error. I cannot get any plots due to this.

If this is your own system, do you know how much RAM you have ?
what operating system do you use ?
are you multitasking so that other heavyweight applications are taking up significant RAM space ?

in the context of these you could go through this section

I don't understand. What do you mean by pull it open?

Put your cursor on the divider between the main coding area and the plot display area---it should change to a hand image. Pull, in my case to the left, and the plot display area should increase and the coding area decrease.