Windtalker
Windtalker

Reputation: 796

Couldn't quit R session or couldn't quit RStudio

New to R and RStudio, got problem in operating RStudio.

I have a code sample about 53 lines, I could quit by typing "q()" or "quit()", but after I run any code(selected section or all codes), "q()" will not work as pic showing below enter image description here

Or if I try to close RStudio browser, then a notification show up as below but never quit. enter image description here

Any hint?

Thanks very much!

PS: RStudio verson: 0.99.948

-----1st Update------ @Mike Wise

Tried to get session info by typing "sessionInfo()" in console, unfortunately no response...pic below enter image description here

Again, this case only happens after I run my code

-----2nd Update------- do the sessionInfo() before you run the code:

Info as below:

R version 3.2.3 (2015-12-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

locale: 1 LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C
LC_TIME=English_United States.1252

attached base packages: 1 stats graphics grDevices utils
datasets methods base

loaded via a namespace (and not attached): 1 tools_3.2.3

My code:

# Linear Regression in R
# Copyright 2013 by Ani Katchova

mydata <- read.csv(file="E:\\Econometric Academy\\Linear Regression\\regression_auto.csv", header=TRUE, sep=",")
attach(mydata)

# Define variables
Y <- cbind(mpg)
X1 <- cbind(weight1)
X <- cbind(weight1, price, foreign)

# Descriptive statistics
summary(Y)
summary(X)

# Correlation among variables
cor(Y, X)

# Plotting data on a scatter diagram
plot(Y ~ X1, data = mydata)

# Simple linear regression 
olsreg1 <- lm(Y ~ X1)
summary(olsreg1)
confint(olsreg1, level=0.95)
anova(olsreg1)

# Plotting regression line
abline(olsreg1)

# Predicted values for dependent variable
Y1hat <- fitted(olsreg1)
summary(Y1hat)
plot(Y1hat ~ X1)

# Regression residuals
e1hat <- resid(olsreg1)
summary(e1hat)
plot(e1hat ~ X1)

# Multiple linear regression
olsreg2 <- lm(Y ~ X)
summary(olsreg2)
confint(olsreg2, level=0.95)
anova(olsreg2)

# Predicted values for dependent variable
Yhat <- fitted(olsreg2)
summary(Yhat)

# Regression residuals
ehat <- resid(olsreg2)
summary(ehat)

Upvotes: 20

Views: 35031

Answers (6)

Nicol&#225;s Rojas U
Nicol&#225;s Rojas U

Reputation: 63

I had the same issue and tried every solution i found and nothing worked. The only thing that i came up with that worked was:

Step 1: Deleting the folder 'R' in C:\Users\ [username]\Documents\R and the .Rdata in 'Documents'

Step 2: Uninstalling Rstudio AND R.

Step 3: Reinstall both R and Rstudio and voilá.

Hope it helps someone after all this time.

Upvotes: 1

Soulblighter
Soulblighter

Reputation: 61

On Windows, I had to delete folder "C:\Users\\AppData\Local\RStudio-Desktop" to fix this issue.

Upvotes: 5

InfoMK
InfoMK

Reputation: 45

Posting this answer for someone still looking for a solution. Task Manager >Processes >Apps >RStudio> right click >End Task. This is for windows and for Mac,force quit method should probably work! Thanks!

Upvotes: 3

Bart
Bart

Reputation: 21

I had a similar problem. When trying to close RStudio, i stalled in "Quitting R Session", never stopped spinning, and the system memory kept increasing till almost all RAM was occupied. Killing the R session or Rstudio via the Task Manager, rebooting, .. nothing helped. Everytime i restarted RStudio, not a single command could be executed without entering immediately in the "Quitting R Session" situation again.

What helped is, when you restart RStudio, immediately go to menu Session | Terminate R and restart RStudio once more.

Upvotes: 2

ferrelwill
ferrelwill

Reputation: 821

If you are using Mac, open "Activity Monitor" and double click on "Rstudio" and select "Force quit".

Upvotes: 0

Denis Rasulev
Denis Rasulev

Reputation: 4069

Check your RStudio -> Preferences. Tab General, this option:

enter image description here

Probably, after running your code you have huge variables in memory and RStudio tries to save your workspace and it takes time.

Upvotes: 3

Related Questions