I am running a simulation with Rstan in R, and every time, when I call replicate() function, even for only 100 simulations, there is an error message showing below:
Error in file(file, "r") : all connections are in use
Called from: file(file, "r")
Browse[1]> proc.time() - star
user system elapsed
247.93 1.23 1416.02
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
<simpleError in textConnection("rval", "w", local = TRUE): all connections are in use>
I googled this error, and used rm(object) and showConnections(all=T), closeAllConnections() in the analysis functions as suggested. But I still encounter this error on Windows OS, the code works quite well on Mac OS. So I am thinking that it is a OS specific issue.