Getting help on R command line window
I wanted to get help about repeat in R command line window. But
> ?repeat
+
> help(repeat)
Error: unexpected ')' in "help(repeat)"
repeat seems different from other fu开发者_运维知识库nctions. 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!
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`
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.
help("repeat")
?"repeat"
精彩评论