使用版本0.98.11013.假设我在我的脚本中测试以下代码:
for (num in 1:5)
{
# Print numbers from 1 to the loop variable
print(1:num)
}
Run Code Online (Sandbox Code Playgroud)
当我跨过每一行(使用CTRL + R)时,我在控制台中获得以下输出:
> for (num in 1:5)
+ {
+ # Print numbers from 1 to the loop variable
+ print(1:num)
+ }
[1] 1
[1] 1 2
[1] 1 2 3
[1] 1 2 3 4
[1] 1 2 3 4 5
>
Run Code Online (Sandbox Code Playgroud)
现在,说我在我的代码中犯了一个错误并忘记了结束括号}:
for (num in 1:5)
{
# Print numbers from 1 to the loop variable
print(1:num)
randomArray <- c(1:10)
# ...and the next line of the R script
Run Code Online (Sandbox Code Playgroud)
现在,控制台显示+每行的符号,因为它正在寻找一个右括号.R或RStudio的新手可能没有意识到这一点.除了关闭和重新打开RStudio之外,我所做的任何事情都没有得到输出.
有没有办法强制RStudio控制台(或者它是R解释器?)"重置"?