在R命令行窗口获得帮助

时间:2021-11-11 14:56:37

I wanted to get help about repeat in R command line window. But

我想在R命令行窗口中获得有关重复的帮助。但

> ?repeat  
+   
> help(repeat)  
Error: unexpected ')' in "help(repeat)"  

repeat seems different from other functions. Also I found even for if, I also cannot get help document. So I assume help is just for non control-follow function/command? How to get the help document about control flow commands then?

重复似乎与其他功能不同。我也发现即使是,我也无法得到帮助文件。所以我假设帮助仅适用于非控制跟随功能/命令?如何获取有关控制流命令的帮助文档呢?

Thanks!

2 个解决方案

#1


7  

repeat, for, etc are parts of the language that the parser gives high priority to; in this case R thinks you were going to write something it needed to evaluate before calling the function ?() on the result. The canonical solution is to quote the function name using backticks:

repeat,for等是解析器优先考虑的语言的一部分;在这种情况下,R认为在调用函数函数?()之前,你要编写需要评估的东西。规范解决方案是使用反引号引用函数名称:

?`repeat`

As DWin notes above, this can be used for any function name. Backticks are also useful for quoting objects or components of lists/data frames that have non-standard names.

如上面的DWin所述,这可以用于任何函数名称。反引号对于引用具有非标准名称的列表/数据框的对象或组件也很有用。

#2


6  

help("repeat")

?"repeat"

#1


7  

repeat, for, etc are parts of the language that the parser gives high priority to; in this case R thinks you were going to write something it needed to evaluate before calling the function ?() on the result. The canonical solution is to quote the function name using backticks:

repeat,for等是解析器优先考虑的语言的一部分;在这种情况下,R认为在调用函数函数?()之前,你要编写需要评估的东西。规范解决方案是使用反引号引用函数名称:

?`repeat`

As DWin notes above, this can be used for any function name. Backticks are also useful for quoting objects or components of lists/data frames that have non-standard names.

如上面的DWin所述,这可以用于任何函数名称。反引号对于引用具有非标准名称的列表/数据框的对象或组件也很有用。

#2


6  

help("repeat")

?"repeat"