R:注释掉代码块 [英] R: Comment out block of code

查看:173
本文介绍了R:注释掉代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

R:多行注释解决方法?

我想注释掉几个是否有任何方法可以不必在每行之前放置#来实现它-就像SAS中的 / *阻止代码* / 一样?

I want to comment out several lines of code in R. Is there any way of doing it without having to put a # before each line - sort of like /* blocked out code */ in SAS?

推荐答案

大多数编辑器都采用某种快捷方式来注释掉代码块。默认的编辑器使用命令或控件以及单引号等内容注释掉选定的代码行。在RStudio中,它是 Command Control + / 。签入您的编辑器。

Most of the editors take some kind of shortcut to comment out blocks of code. The default editors use something like command or control and single quote to comment out selected lines of code. In RStudio it's Command or Control+/. Check in your editor.

它仍在逐行注释,但它们也会取消对选定行的注释。对于Mac RGUI,它是命令选项’(我想象Windows是控制选项)。对于Rstudio,它只是 Command Control + Shift + C

It's still commenting line by line, but they also uncomment selected lines as well. For the Mac RGUI it's command-option ' (I'm imagining windows is control option). For Rstudio it's just Command or Control + Shift + C again.

随着编辑器的更新以及不同的软件成为最受欢迎的R编辑器,这些快捷方式可能会随着时间而改变。您必须对它进行查找以查找所拥有的任何软件。

These shortcuts will likely change over time as editors get updated and different software becomes the most popular R editors. You'll have to look it up for whatever software you have.

这篇关于R:注释掉代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆