简体   繁体   English

无法退出 R 会话或无法退出 RStudio

[英]Couldn't quit R session or couldn't quit RStudio

New to R and RStudio, got problem in operating RStudio. R 和 RStudio 的新手,在操作 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我有一个大约 53 行的代码示例,我可以通过键入“q()”或“quit()”退出,但是在我运行任何代码(选定部分或所有代码)后,“q()”将无法像图片一样工作显示如下在此处输入图像描述

Or if I try to close RStudio browser, then a notification show up as below but never quit.或者,如果我尝试关闭 RStudio 浏览器,则会显示一条通知,但不会退出。 在此处输入图像描述

Any hint?有什么提示吗?

Thanks very much!非常感谢!

PS: RStudio verson: 0.99.948 PS:RStudio版本:0.99.948

-----1st Update------ @Mike Wise -----第一次更新------ @Mike Wise

Tried to get session info by typing "sessionInfo()" in console, unfortunately no response...pic below试图通过在控制台中键入“sessionInfo()”来获取会话信息,不幸的是没有响应......如下图在此处输入图像描述

Again, this case only happens after I run my code同样,这种情况只会在我运行代码后发生

-----2nd Update------- do the sessionInfo() before you run the code: -----第二次更新-------- 在运行代码之前执行 sessionInfo():

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 R 版本 3.2.3 (2015-12-10) 平台:x86_64-w64-mingw32/x64(64 位) 运行于:Windows 7 x64(内部版本 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语言环境: 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 LC_TIME=English_United States.1252

attached base packages: 1 stats graphics grDevices utils附加基础包: 1 stats graphics grDevices utils
datasets methods base数据集方法基础

loaded via a namespace (and not attached): 1 tools_3.2.3通过名称空间加载(未附加): 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)

On Windows, I had to delete folder "C:\Users\\AppData\Local\RStudio-Desktop" to fix this issue.在 Windows 上,我必须删除文件夹“C:\Users\\AppData\Local\RStudio-Desktop”才能解决此问题。

Check your RStudio -> Preferences.检查您的 RStudio -> 首选项。 Tab General, this option: Tab General,这个选项:

在此处输入图像描述

Probably, after running your code you have huge variables in memory and RStudio tries to save your workspace and it takes time.可能在运行您的代码后,您的内存中有大量变量,RStudio 会尝试保存您的工作区,这需要时间。

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.当试图关闭 RStudio 时,我在“退出 R 会话”中停滞不前,从未停止旋转,系统内存不断增加,直到几乎所有 RAM 都被占用。 Killing the R session or Rstudio via the Task Manager, rebooting, .. nothing helped.通过任务管理器终止 R 会话或 Rstudio,重新启动,.. 没有任何帮助。 Everytime i restarted RStudio, not a single command could be executed without entering immediately in the "Quitting R Session" situation again.每次我重新启动 RStudio 时,如果不立即再次进入“退出 R 会话”情况,则无法执行任何命令。

What helped is, when you restart RStudio, immediately go to menu Session |有用的是,当您重新启动 RStudio 时,立即转到菜单 Session | Terminate R and restart RStudio once more.终止 R 并再次重新启动 RStudio。

Posting this answer for someone still looking for a solution.为仍在寻找解决方案的人发布此答案。 Task Manager >Processes >Apps >RStudio> right click >End Task.任务管理器 > 进程 > 应用程序 > RStudio > 右键单击 > 结束任务。 This is for windows and for Mac,force quit method should probably work!这是针对 windows 和 Mac 的,强制退出方法应该可行! Thanks!谢谢!

If you are using Mac, open "Activity Monitor" and double click on "Rstudio" and select "Force quit".如果您使用的是 Mac,请打开“活动监视器”并双击“Rstudio”并选择“强制退出”。

This is exactly what is happening to me as well. 这也正是我正在发生的事情。 I can start a new R session and work in the different window, but my troublesome R session will not quit, run, or GO AWAY. 我可以启动一个新的R会话并在其他窗口中工作,但是麻烦的R会话不会退出,运行或消失。 I've tried to end the task through task manager, but every time I reopen R, there is the same nuisance session again. 我试图通过任务管理器结束任务,但是每次我重新打开R时,都会再次出现相同的令人讨厌的会话。 I uninstalled, restarted, and reinstalled R stuido and the same darn R session pops up again when I open R. I've searched for and deleted all my .Rhistory and .Rdata files in my folder and yet there is the same R session and it is driving me MADDDD!!! 我卸载,重新启动并重新安装了R stuido,当我打开R时,再次弹出相同的织补R会话。我已经搜索并删除了文件夹中的所有.Rhistory和.Rdata文件,但是存在相同的R会话和它让我疯狂!!! Can someone please suggest how I can "restore factory defaults" or whatever the equivalent is so I can get rid of this R session that won't work and won't quit? 有人可以建议我如何“恢复出厂默认设置”或任何等效的设置,以便我摆脱无法正常工作且不会退出的R会话吗?

THANK YOU :D 谢谢你:D

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'第 1 步:删除 C:\Users\ [用户名]\Documents\R 中的文件夹 'R' 和 'Documents' 中的.Rdata

Step 2: Uninstalling Rstudio AND R.第 2 步:卸载 Rstudio 和 R。

Step 3: Reinstall both R and Rstudio and voilá.第 3 步:重新安装 R 和 Rstudio,瞧瞧。

Hope it helps someone after all this time.希望这一切对某人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM