代码在R中显示为注释?

use*_*092 2 comments r

我知道:

# this is a comment
code <- ("this is code")
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我它是如何可能的,并且一些R代码以绿色(如注释)出现,即使我没有在代码前面说过#?代码可以毫无困难地运行,这是奇怪的部分吗?

我的一个学生有这个"问题",我无法弄清楚为什么代码显示为绿色?

在此先感谢您的回答:)

亲切的问候玛丽亚

csg*_*pie 5

我强烈怀疑你的学生没有那个确切的问题.相反,我怀疑发生的事情是他们在评论之前错过了一些语音标记.例如,这段代码

x = "fred
#Some stuff
# this is a comment
code = ("this is code")
Run Code Online (Sandbox Code Playgroud)

在Rstudio使一切都"绿色":

在此输入图像描述