Abstract
R includes an online help. It is very complete and very well structured for all functions and for the various symbols in the language. There are several ways to access the help files; the main method is help(). It is used in command line mode.
Access provided by Autonomous University of Puebla. Download chapter PDF
Similar content being viewed by others
Keywords
- Command Line Mode
- Frequently Asked Questions (FAQ)
- Command Help
- Internet Relay Chat (IRC)
- Message Boards
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
FormalPara Prerequisites and goals of this chapter-
This chapter presents the various ways to get help on the R software.
1 Integrated Help
1.1 The Command help()
R includes an online help. It is very complete and very well structured for all functions and for the various symbols in the language. There are several ways to access the help files; the main method is help(). It is used in command line mode.
For example, type:
help(help)
There is an alias for the command help(): the question mark ?.
?sum
?sd
?"+"
?"[["
Warning
Sometimes, this alias will not work. In those cases, you will need to use the function help() with quotation marks.
?function # Does not work.
help(function) # Returns an error.
help("function") # Correct call.
Let us look at the help of the function mean().
Here are the sections of this help file:
-
-
①
The header of the file, with:
-
The name of the function: mean
-
The name of the package in which the function is included: base
-
The origin of the help file: R Documentation
-
②
An explicit title for the function: Arithmetic Mean
-
③
A brief description of what the function does: Description
-
④
How to use the function; in particular, the compulsory and optional arguments: Usage
-
⑤
A description of the function’s arguments: Arguments
-
⑥
Explanations on the output of the function: Value
-
⑦
References (statistical articles or books) related to the function’s application domain: References
-
⑧
The See Also section, which lists similar or related functions
-
⑨
Examples of use: Examples
-
①
Warning
Most help files follow this format. Make sure you understand and remember the structure of help files. You should also take the habit of checking the online help whenever you meet an unknown function, so as to understand its arguments and use.
Tip
Note that help files do not include graphs, for example, those that could be produced with the code in the section Examples \(\bigcirc \!\!\!\!9\). This would be interesting, especially for all the graphical functions. One way to get them is the function example(). You can also browse the website R Graphical Manual: http://bm2.genes.nig.ac.jp/RGM2/index.php which includes all R help files in HTML. In those files, when there are graphs, they are directly included in the section Examples.
1.2 Some Complementary Commands
In addition to the main command, help(), a few other complementary functions can be useful when looking for help on a given command. They are listed here:
-
help.start(): this function opens a web browser with links to handbooks in HTML, help on functions included in all R packages (also HTML), a FAQ (Frequently Asked Questions), and a search engine of the help files. There are also other more technical documents.
Linux
Under Linux, once you have entered the command help.start(), using the command help() will always result in the help being displayed in the web browser, rather than in the command line. To cancel this behaviour, use the instruction options(htmlhelp = FALSE). To change browser (e.g., firefox), use the instruction options(browser="firefox").
-
help.search() or ??(): this function is useful when you do not know the name of a command. It returns a list of functions (and the package in which they are included) related to your request. Try: help.search("mean").
-
apropos(): this instruction returns the names of functions which are a (potentially partial) match to the calling argument. For instance, apropos("mean") returns the names of functions containing the word mean.
Advanced users
Note also that the function methods() returns all the methods (functions) associated with an object. For instance, try methods(summary).
-
library(help=package): this command lists all functions included in a package. It gives the same results as the command help(package="package"). We advise you to try the following instructions to list the main functions in R:
library(help=base)
library(help=utils)
library(help=datasets)
library(help=stats)
library(help=graphics)
library(help=grDevices)
Tip
The function library(lib.loc =.Library) returns the list of all packages (or libraries) installed on the system.
Conversely, the instruction find(" function ") indicates in which package a function is included.
> find("t.test")
[1] "package:stats"
-
vignette(): vignettes are small PDF files which explain some notions in further detail. Type vignette() to get a list of vignettes, and for example vignette("xtableGallery") to open the PDF vignette of the package xtable.
Mac
All vignettes can also be read in a special vignette browser, from the menu “Help/Vignettes”. In this browser, you can open PDF files as well as R source code (as .R files) and consult directly the code of examples included in the vignette.
These three other functions might also be useful:
-
data(): this command lists all datasets included in R.
-
example(): this instruction lists examples of use of a function. For example, example(mean) executes the instructions included in the section Examples of the help file help(mean).
-
demo(): this instruction is similar to example(), but is only available for a small number of functions. When it is available, it shows the range of possible uses of a function. For example, try demo(graphics).
2 † Help on the Web
The official R website (http://www.r-project.org) includes a huge amount of information about this software. You should spend some time exploring it. The following sections list other sources of information.
2.1 Search Engines
There are two main search engines for R:
Tip
The command RSiteSearch() can be used to send a request on this website directly from R. The information is then displayed in your browser.
There is also a very interesting collaboratively edited question and answer site for programmers available at URL http://stackoverflow.com/questions/tagged/r.
2.2 Message Boards
There are many message boards about R, where you can ask your questions. One message board with a lot of traffic is http://r.789695.n4.nabble.com.
2.3 Mailing Lists
A mailing list is a specific kind of e-mail, which sends messages to a large number of subscribers.
There are several mailing lists about R. The main ones are:
-
R-announce: https://stat.ethz.ch/mailman/listinfo/r-announce
The website http://r-project.markmail.org can be used to search the archives of these lists.
You need to follow a few rules to post a message on these lists, as described here: http://www.r-project.org/posting-guide.html.
Mac
A list dedicated to Mac users: https://stat.ethz.ch/mailman/listinfo/r-sig-mac.
2.4 Internet Relay Chat (IRC)
IRC (Internet relay chat) is a real-time messaging service. You can use it to chat with other Internet users on predefined themes. The IRC channel on the R software is called (#R) on the freenode server.
To access it, you can either use client-side software such as xchat (www.xchat.org) or use your browser through websites such as https://webchat.freenode.net.
To connect to this channel using xchat, type in these instructions:
/server irc.freenode.net
/join #R
2.5 Wiki
A wiki is a website where pages can be freely edited by visitors. Wikis are used to aid collaborative writing with minimal constraints.
There is a wiki about R here: http://rwiki.sciviews.org.
3 † Literature About R
3.1 Online
Literature about R is available online in many forms:
-
Task Views: lists of packages useful in a given domain, grouped by themes. A website describing Task Views is available at the URL http://cran.r-project.org/web/views.
-
Frequently Asked Questions (FAQ): Frequently Asked Questions about R are listed here: http://cran.r-project.org/faqs.html.
-
Specialized journals: two online journals deal with the R software: the R Journal, previously known as R News (http://journal.r-project.org), and the Journal of Statistical Software (http://www.jstatsoft.org).
-
Handbooks: many handbooks are available as a PDF on the R website: http://cran.r-project.org/other- docs.html.
3.2 Printed Material
Many books have been published about R recently. We find the following to be the most interesting:
-
Data Analysis and Graphics Using R:An Example-Based Approach [26]
-
The R Book [12]
-
Statistics and Data with R [10]
-
Software for Data Analysis: Programming with R [8]
-
Lattice: Multivariate Data Visualization with R [36]
-
R for SAS and SPSS Users [32]
-
Introductory Statistics with R:An Applied Approach Through Examples [13]
-
A First Course in Statistical Programming with R [6]
-
A Handbook of Statistical Analyses Using R [15]
-
A Beginner’s Guide to R [42]
-
R Cookbook [39]
-
R in a Nutshell [1]
-
The Art of R Programming [28]
-
The R Inferno [7]
Memorandum
-
help(), ?(): get help on a function or a symbol
-
help.search(): list of functions relevant to your request
-
apropos(): list of function names which include the request
-
library(help=package): list of all functions in a package
-
data(): list of all datasets available in R
-
example(): execute the Examples section of the corresponding help file
-
demo(): launch a small demonstration of the possible uses of a function
-
vignette(): open a PDF file with details on a function
-
help.start(): open the HTML version of the R help files
-
RSiteSearch(): start a request on the official R website search engine
Exercises
-
6.1-
Which R instruction should you type to get help on the function mean()?
-
6.2-
Explain the purpose of the command apropos().
-
6.3-
Explain the purpose of the command example().
-
6.4-
Explain the purpose of the command RSiteSearch().
-
6.5-
How is a help file structured?
-
6.6-
Which command would you use to get the list of functions available in the package stats?
-
6.7-
Explain how to display a dataset available in R.
Worksheet
Where to Find Information
-
6.1-
Find the R function which lists all combinations of k elements out of n.
-
6.2-
Use this function to list all combinations of three elements out of c(5,8,2,9).
-
6.3-
Find the dataset available in R which gives the rates of violent crimes in the USA.
-
6.4-
Describe the contents of this dataset.
-
6.5-
Subscribe to the mailing list https://stat.ethz.ch/mailman/ listinfo/r-help.
-
6.6-
Read the rules to follow before asking a question (http://www.r-project.org/posting-guide.html).
-
6.7-
Find out how to unsubscribe from the mailing list.
-
6.8-
Using the method of your choice, join the IRC channel R and start a polite conversation with channel members.
-
6.9-
Register on the message board http://r.789695.n4.nabble.com.
-
6.10-
Read the R FAQ for Microsoft Windows. Try to understand the meaning of TAB completion.
-
6.11-
Use TAB completion to list all files in the current directory.
References
Adler J. R in a Nutshell. O’Reilly, 2010.
Akaike H. Information Theory and an Extension of the Maximum Likelihood Principle. In Petrov B. N. and Csaki F., editors, Proc. of the 2nd Int. Symp. on Information Theory, pages 267–81, 1973.
Becker R. A., Chambers J. M. and Wilks A. R. The New S Language: A Programming Environment for Data Analysis and Graphics. Chapman & Hall, 1988.
Belsley D. A., Kuh E. and Welsch R. E. Regression Diagnostics: Identifying Influential Data and Sources of Collinearity. Wiley Series in Probability and Mathematical Statistics. John Wiley & Sons, New York-Chichester-Brisbane, 1980.
Bilodeau M. and Lafaye de Micheaux P. A-dependence Statistics for Mutual and Serial Independence of Categorical Variables. Journal of Statistical Planning and Inference, 139:2407–19, 2009.
Braun J. W. and Murdoch D. J. A First Course in Statistical Programming with R. Cambridge University Press, 1st edition, January 2008.
Burns P. The R inferno. Unpublished manual, Amazon, 2011.
Chambers J. M. Software for Data Analysis: Programming with R. Statistics and Computing. Springer, June 2008.
Chivers I. and Sleightholme J. Introduction to Programming with Fortran: With Coverage of Fortran 90, 95, 2003, 2008 and 77. Springer, 2nd edition, 2012.
Cohen Y. and Cohen J. Statistics and Data with R: An Applied Approach Through Examples. Wiley, 2008.
Cook R. D. and Weisberg S. Residuals and Influence in Regression. Monographs on Statistics and Applied Probability. Chapman & Hall, London, 1982.
Crawley M. J. The R Book. Wiley, Chichester, June 2007.
Dalgaard P. Introductory Statistics with R (Statistics and Computing). Springer, 2nd edition, August 2008.
Davison A. C. and Hinkley D. V. Bootstrap Methods and their Applications, volume 1 of Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, Cambridge, 1997. With 1 IBM-PC floppy disk (3.5 inch; HD).
Everitt B. S. and Hothorn T. A Handbook of Statistical Analyses Using R. Chapman & Hall/CRC, 1st edition, February 2006.
Fisher R. A. Statistical Methods for Research Workers, 4th edition §21.1. Oliver & Boyd, Edinburgh, 1932.
Fox J. Extending the R Commander by “plug in” Packages. R News, 7(3):46–52, 2007.
Furnival G. M. and Jr. Wilson R. W. Regression by Leaps and Bounds. Technometrics, 16:499–511, 1974.
Hand D. J. Branch and Bounds in Statistical Data Analysis. The Statistician, 30:1–13, 1981.
Heiberger R. M. and Neuwirth E. R Through Excel. Use R! Springer, 2009.
Ihaka R. and Gentleman R. R: A Language for Data Analysis and Graphics. Journal of Computational and Graphical Statistics, 5(3):299–314, 1996.
Kernighan B. W. and Ritchie D. M. The C Programming Language, Second Edition. Prentice Hall, 1988.
Lafaye de Micheaux P. and Liquet B. ConvergenceConcepts: An R Package to Investigate Various Modes of Convergence. R Journal, 1(2):18–26, 2009.
Lafaye de Micheaux P. and Liquet B. Understanding Convergence Concepts: A Visual-minded and Graphical Simulation-based Approach. The American Statistician, 63(2):173–8, 2009.
Levene H. Robust Tests for Equality of Variances. In Contributions to probability and statistics, pages 278–92. Stanford Univ. Press, Stanford, Calif., 1960.
Maindonald J. and Braun J. Data Analysis and Graphics Using R: An Example-based Approach (Cambridge Series in Statistical and Probabilistic Mathematics). Cambridge University Press, December 2006.
Mallows C. L. Some Comments on c p . Technometrics, 15:661–75, 1973.
Matloff N. The Art of R Programming. No Starch Press, 2011.
Meyer C. Matrix Analysis and Applied Linear Algebra. Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA, 2000. With 1 CD-ROM (Windows, Macintosh and UNIX) and a solutions manual (iv+171 pp.).
Jr. Miller and Rupert G. Simultaneous Statistical Inference. Springer Series in Statistics. Springer-Verlag, New York, 2nd edition, 1981.
Montgomery D. C. Design and Analysis of Experiments. Wiley, 7th edition, 2008.
Muenchen R. A. R for SAS and SPSS Users. Springer Series in Statistics and Computing. Springer, 2009.
Muenchen R. A. and Hilbe J. M. R for Stata Users. Statistics and Computing. Springer, 2010.
Park S. K. and Miller K. W. Random Number Generators: Good Ones are Hard to Find. Commun. ACM, 31(10):1192–1201, 1988.
Robert C. and Casella G. Introducing Monte Carlo Methods with R (Use R!). Springer, 2009.
Sarkar D. Lattice: Multivariate Data Visualization with R. Use R! Springer, March 2008.
Schwarz G. Estimating the Dimension of a Model. Annals of statistics, 6:461–64, 1978.
Stroustrup B. The C++ Programming Language, Third edition. Addison-Wesley, 1997.
Teetor P. R Cookbook. O’Reilly, 2011.
Vinod H. D. Hands-on Intermediate Econometrics Using R: Templates for Extending Dozens of Practical Examples. World Scientific, Hackensack, NJ, 2008.
Weisberg S. Applied Linear Regression, 3rd edition. Wiley-Interscience, 2005.
Zuur A. F., Ieno E. N. and Meesters E. H.W.G. A Beginner’s Guide to R. Springer, 2009.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer Science+Business Media New York
About this chapter
Cite this chapter
de Micheaux, P.L., Drouilhet, R., Liquet, B. (2013). R and Its Documentation. In: The R Software. Statistics and Computing, vol 40. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-9020-3_6
Download citation
DOI: https://doi.org/10.1007/978-1-4614-9020-3_6
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4614-9019-7
Online ISBN: 978-1-4614-9020-3
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)