我在 R 控制台中输入了一些内容:
> ta <- function(x,y){
+ x=x+2
+ y=y+1
+
现在我的光标在第四行,我发现它是x=x+1
,不是x=x+2
。
我可以将光标移到第二行以修改x=x+2
吗x=x+1
?
As far as I'm aware, you can't do what you describe. What you can do is press Esc to cancel entering into the console and start afresh writing it in.
Are you using an IDE? Or are you writing directly into the RGui? If the latter, I heartily recommend using RStudio. It will make your life a lot easier. You'll be able to to enter text into one window and then send it into the R console when you're ready.
Alternatively. R does have an editor (File > New script) which you can use to send lines, or you can even use a txt file off to the side and only send lines when you're ready.
如果您从终端运行 R,您可以按ctrl+c取消您的输入并重新开始。