Help pls: ggplot output shown multiple times in rnotebook after loading *.Rproj

Hello there,
I'm kinda new to R and RStudio and I'm facing an annoying problem with which I hope someone can help me.
I've been plotting a lot of my data for an intial EDA, which is working fine, except for one issue.

I'm using the most up to date versions of all the packages. The same goes for RStudio.

The problem is, that the output from ggplot() and ggpairs() is shown either twice or thrice (seldomly only once, which would be correct) within my *.rmd document. To be precise, the *.rmd is a rnotebook version (sorry if I'm not using the corret lingo, but i don't know better).
So far, I have not been able to discern a pattern when it will show the output two or three times, but more often than not, it will be only twice.

The problem exclusivly occurs after loading the saved file. By that I mean, that when I write new code and run it, everything works fine. Also, when I load my *.Rroj, re-run already writen code, everything is fine. The output will be shown normal, i.e. only once.
But after the initial loading of the *.Rproj file and continuing my work in the *.rmd document, of cource, I'll be shown my previous work including the code as well as the already produced output whitin the *.rmd/rnotebook document. Only here and than occurs the problem: All the outout produced be ggplot() and ggpairs() will be shown either twice or thrice (seldomly only once). Output produced by other functions, for example tableby(), levene.Test(), t.test(), will be shown correctyl every single time.

I've been dealing with this problem for two months now, and was hoping that some update (either Windows 10, RStudio or ggplot()/ggpairs()) would solve the issue. But so far, it persists.

I included a picture of the problem within this post, but since it is low-res, here's also the high-res version available: https://imgur.com/a/2qW7OAo

I hope someone can help me. Thanks!

This also happens to me from time to time, I don't know the cause and it is so sporadic that I haven't identified the steps to reproduce the issue to file a propper issue report but It usually gets solved for me by clearing all outputs and executing all code chunks again.

On more extreme occasions I had to manually delete the hidden .Rproj.user folder to clear all cache in the project.

1 Like

Thanks for the advice, I'll try it later.

I cleared the output and also deleted the hidden file .Rproj.user
Since my problem only occured after loading the file and I'm going to work with the file every day of this week, I'll write an update in the next couple of days.
Thanks so far!

Sadly I'm already back with an update: After loading the file today, pretty much of my output is shown thrice. Of cource I can clear all the output agarin and re-run all the code chunks, which will solve the problem for this work session, but it is still an annoying bug.

Try with the latest preview version of RStudio

And if the problem persists, file an issue report on the GitHub repository.

1 Like

Oh thanks, for both the links! I'll give the Preview Version a try and if the problem should still persist, I'll file the issue report. Cheers!

Quick update and again a big thanks to the user adresrcs.

The issue seems to have been solved. I installed the preview version mentioned above, cleared all output, deleted .Rproj.user manually and re-run all the code. After doing all that, I have been free of the bug for two days now. I hope it stays that way.

Another (sad) update. Apparently the solution is not a permanent one. Every now and then the same problem occurs again. Also I'm still not able to intentionally reproduce the issue or the solution. The whole issue seems to be somewhat random to me.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.