Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting help on R command line window

Tags:

r

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!

like image 400
Tim Avatar asked Dec 05 '10 15:12

Tim


People also ask

How do I get help from R commands?

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 ?

How do you access the help in RStudio?

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.

Does R have a help function?

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.

How do I access R from command line?

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.


2 Answers

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.

like image 179
Gavin Simpson Avatar answered Oct 05 '22 05:10

Gavin Simpson


help("repeat")

?"repeat"

like image 25
aL3xa Avatar answered Oct 05 '22 05:10

aL3xa