2

When I run a large R scripts (works nicely as expected, basically produces a correct PDF at the end of the script (base plotting plus beeswarm, last line of script is dev.off()), I notice that the PDF is finished after ~3 seconds and can even be opened in other applications, long before the console output (merely few integer values and echo of code ~400 lines) is finished (~20 seconds). There are no errors reported. In between, the echo stops and does nothing for seconds.

I work with R Studio V0.97.551, R version 3.0.1, on Win-7.

gc() or close and restart R did not help, and the data structures used are not big anyway (5 dataframes with up to 60 obs and 64 numeric or short character variables). The available memory should be sufficient (according to task manager, around 4 GB throughout), but CPU is busy during that time.

I agree this is not reproducible for other people w/o the script, which is however too large to post, but maybe someone has experienced the same problem or even an explanation or suggestion what to check? Thanks in advance!

EDIT: I run exactly the same code directly in R 3.0.1 (w/o RStudio), and the problem was gone, suggesting the problem is related to RStudio. I added the tag RStudio, but I am not sure if I am now supposed to move this question somewhere else?

Martin
  • 594
  • 5
  • 16
  • Do you mean `dev.off()`? – MrFlick Jul 31 '14 at 17:40
  • @MrFlick sorry, yes, dev.off(). Corrected this, see also edit on RStudio. – Martin Jul 31 '14 at 17:49
  • I think this is still an appropriate place for this question. Does this happen with all PDFs? It would best best if you could post code that [reproduces](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) the problem for you so others can try as well and offer better suggestions. – MrFlick Jul 31 '14 at 17:51
  • Are you running the script step-by-step or are you sourcing it? – Roman Luštrik Jul 31 '14 at 18:02
  • @RomanLuštrik I run it as the whole code block (not by source). – Martin Jul 31 '14 at 18:06
  • @MrFlick I am not sure if "all PDFs", but I remember that I have experienced this behaviour earlier with other scripts, although I do not recall exactly which PDF. – Martin Jul 31 '14 at 18:36

1 Answers1

0

Recently I came across similar problem--running from RStudio becomes very slow, even when it is executing something as simple as example('plot'). After searching around, this post pointed me to the right place that eventually led to a workaround: resetting RStudio by renaming the "RStudio-Desktop Directory". The exact way to do so depends upon the OS you are using, and you could find the detail instruction here. I just tried it, and it works.

API
  • 480
  • 3
  • 10