Elliott
Elliott

Reputation: 5609

Cannot run scripts in Rstudio

I'm working through some exercises in an Introduction to R book (A Dummy's Book to be specific). I am running Rstudio version 1.1.447. I Enter the following script

h <-hello
yourname <-readline("What is your name")
Print(paste(h,yourname))

I then press Ctrl+Shift+S. When I do this, I get the following error message:

Error in file(con, "w") : cannot open the connection In addition: Warning message: In file(con, "w") : cannot open file 'C:/Users/efami/OneDrive/Documents/.active-rstudio-document': Permission denied

I am running RStudio in Administrative Mode in a Windows 10 system. I do not understand where this path is coming from (it's obviously picking up something in my environment) or how to get past this problem.

Upvotes: 1

Views: 354

Answers (1)

Elliott
Elliott

Reputation: 5609

I still don't know why it picked up the directory shown in the error message but the trick is to override the directory by creating a .Renviron file. The instructions on how to do this are found here: Change temporary directory

Upvotes: 1

Related Questions