When you wanted to import the text file in R, you must have used read.table()
function. But do you know that you can pass on more than 20 different arguments to read.table()
function?
You must have used lm()
function to come up with linear regression equation, but do you know that you can pass on more than 10 different arguments to the lm() function?
There are loads and loads of such functions available in R, and remembering their every detail is humanly not possible. Fortunately, we have access to R’s extensive and thorough help documentation which we can refer for more details. In this tutorial we will look at different ways of accessing the R’s Help documentation system. There are two ways to look for help in R:
- Built in help system
- online help system
In the first section, we will look at various online resources that can supplement the built in help system. In the second section, we will look at various ways to access the built in help system of R. Let us get started!
Online Resources
R Bloggers
R bloggers is blog aggregator platform that aggregates blogs written in English from across the globe. On this platform, you will find help on variety of different topics such as R programming, data analysis, visualization and machine learning. Since this blog exclusively hosts R related blogs, this is the first place you want to visit if you want help with R. Visit R-Bloggers for more information.
R email list
The R Project maintains a number of subscription-based email lists for posting and answering questions about R. Refer to main R mailing list for more details.
Stack Overflow
Stack overflow is the public Q&A platform that millions of people visit every month to ask questions, learn, and share technical knowledge. If you are stuck up with your R code, or looking for some package in specific domain, the chances are high that someone has already encountered the same or similar problem and has posted the solution on stack overflow portal. To get assistance, you must search for the term you need help with on the Stack Overflow portal. A list of Q&A threads that are pertinent to your query will then be displayed. In case you have encountered a new problem or issue, you can ask for help by providing reproducible example of your analysis along with the R code. Visit stack overflow website for more information. Please visit the help page on How do I ask a good question?
Posit Community
Posit community is run by posit – a developer of RStudio IDE. This is a great place to look at for Announcements, blogs and content related to posit products. Here you can ask the questions related to Posit products, and moderators from Posit team shall answer to your questions.
r4ds Community
An online learning community that brings learners and mentors on a single platform. It runs its own slack help channel to ask and answer the programming questions. Visit Get Help for more details.
Built in help system
R’s built in help system can be accessed using various help functions. Let’s look at these functions one by one:
help( )
help()
function is the primary interface to the help system. Use help()
to access documentation of function and data sets. ? is a shortcut for help()
and returns the same information. Let’s refer the help documentation of plot
function.
help(plot)
?plot
In R, the Help documentation for all the functions is standardized. It means you will get the same sections on every help page. Some of the sections on help page are:
- The function name and package name written in curly brackets are mentioned at the top of the help page. Help page starts with function description.
- The Usage section describes the function signature.
- The Arguments section elaborates various arguments that can be passed into the function.
- The Details section provides additional information on the function
- Examples section gives some use cases. You can copy the examples into your R console to check how the functions are been used.
If you want to use help()
function, you must know the exact name of the function you want the help with. Sometimes this is not possible. In the next section we will look at apropos()
function.
apropos function
The apropos()
function in R is used to return a character vector with the names of objects matching or containing the input character partially. In the code below, we’ll identify all the R objects with names containing “mean” using the apropos()
function. The function returns character vector of all the functions in which search string mean can be found.
apropos("mean")
[1] ".colMeans" ".rowMeans" "colMeans"
[4] "kmeans" "mean" "mean.Date"
[7] "mean.default" "mean.difftime" "mean.POSIXct"
[10] "mean.POSIXlt" "rowMeans" "weighted.mean"
demo function
demo()
displays interactive demonstration of certain topics provided in R package. Typing demo()
in the console will list the demos available in R packages installed.
demo()
If you want to see the demo in package graphics, you can type:
demo(graphics)
It will return the list of all graphics.
help.search
help.search()
will search all the source documentation and return those that match the search string. $??$ is a shortcut for help.search()
and returns the same information.
help.search('regression')
??regression
RSitesearch
RSitesearch()
sends query to site and displays the results in a browser.
RSiteSearch("glm")
Summary
In this tutorial we learned various options to seek help in R programming. We can get help in the form of in-built R documentation or online resources. One of the strengths of R language is its diverse and active community. A community that is always ready to extend the help!
Further Resources
Interested in learning R Programming – the most in-demand open source Data Science Language in Industry. Check out my additional resources:
Enroll forFREE on-demand courseon Introduction to R programming.In this course you will get life time access to more than 2 hours of HD quality pre-recorded videos. Plus additional resources such as R scripts, and discounts on my training products. You can also use comments section in each video to ask me the questions and I will reply back to your queries as soon as possible.
Enroll for my 18 hours of live online training programmein R Programming Language for Data Analysis. Get downloadable PDF notes, 300+ lines of R code which you can use in your projects and 100+ hands on exercises based on real world data sets. Check out thecourse pagefor more information.
Subscribe to the Newsletter– Glimpse and get R tips and tricks, notifications on blogs and youtube videos (I publish 2 blogs and 3 byte sized videos on youtube every week) straight to your inbox.Subscribe here