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 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!
help operator in R provide access to the documentation pages for R functions, data sets, and other objects, both for packages in the standard R distribution and for contributed packages. To access documentation for the standard lm (linear model) function, for example, enter the command help(lm) or help("lm") , or ?
In the RStudio IDE you can click on any function name and press F1 , which will directly open the associated function help text in its pane.
R Has Built-in Help But there are also other ways to get help, such as a web browser and website searches. Some of the ways you can use help are: The help() function or ? operator - for help on commands and packages.
Go to the command prompt [you can simply press the Down Arrow on your keyboard and your cursor will jump the command prompt]. Paste the code at the command prompt [use CNTL+v in windows or ⌘+v in Mac], then press ENTER. You can now interact with R using the command line interface.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With