Launching R help: Error in file(out, "wt") : cannot open the connection

This happens when the temporary directory used by R is deleted. This usually happens when user or the system cleans up the tmp directory while the R session is running. Typically happens if the R session is open for a long time.

Remedy is very simple. You don't actually need to restart R. Just re-create the temporary directory by:

tempdir()
# [1] "C:\Users\XYZ~1\AppData\Local\Temp\Rtmp86bEoJ\Rtxt32dcef24de2"
dir.create(tempdir())

NOTE: this happens to me more and more often in Windows 10... even within like 8 hour session only! Not sure why this happens. See this question: https://superuser.com/questions/1502272/windows-10-cleaning-up-my-temp-dir-too-often


Ok.Thank you all.I was able to resolve this by changing the directory and exiting R and re-logging into swirl.

Tags:

R