2016-05-24 5 views
2

RStudioのbrowser()コマンドを使用して、コード内の行を移動することができます。多くの場合、これは機能します。しかし、Rスクリプトでは動作しないようです。最小限の例を示します(test.Rに次のコードをコピーするだけです)。ブラウザのRStudio "next line"コマンドが機能しない

print("1") 
browser() 
print("2") 
wrong # Produces error, which can not be tracked using browser 
print("3") 

(R-3.3.0、RStudio 0.99.489)
ご迷惑をおかけして申し訳ございません。

@Batanichekのおかげで、次のスクリプトは、問題解決:私はあなたを理解していれば、右

はあなたにすべてのスクリプトを渡すことができ

{ 
print("1") 
browser() 
print("2") 
wrong 
print("3") 
} 

答えて

2

{}

のような
{ 
+ print("1") 
+ browser() 
+ print("2") 
+ wrong # Produces error, which can not be tracked using browser 
+ print("3") 
+ } 
[1] "1" 
Called from: top level 
Browse[1]> n 
debug at #4: print("2") 
Browse[1]> n 
[1] "2" 
debug at #5: wrong 
Browse[1]> n 
Error: object 'wrong' not found 

そしてrunははい、それは停止しないbrowser()

またはソース

source('~/.active-rstudio-document') 
[1] "1" 
Called from: eval(expr, envir, enclos) 
Browse[1]> n 
debug at ~/.active-rstudio-document#4: print("2") 
Browse[2]> n 
[1] "2" 
debug at ~/.active-rstudio-document#5: wrong 
Browse[2]> n 
Error in eval(expr, envir, enclos) : object 'wrong' not found 
+0

場合で停止します。しかし、それはステップごとに進むのではなく、スクリプト全体で続行します。 'Browse [1]> n 'は動作しません。 – Christoph

+0

ええええええええええええ、それは一歩一歩進んでいます。RStudio 0.99.896、R-3.2.5 – Batanichek

+0

Ok。これは機能します。しかし、test.Rスクリプトとしては動作しません。また、.Rスクリプトの "source"(= Ctrl + Shift + S)として実行すると動作しますか? – Christoph

関連する問題