# Getting help in R

883

As part of Learn Data analysis using R tutorials. This post explains how to use help in R or how to find help inside R.

There is extensive online help in the R system, the best starting point is to run the function `help.start()`. This will launch a local page inside your browser with links to the R manuals, R FAQ, a search engine and other links.

### Help function

Now let’s see how to get help on a particular function. In the R Console, the function `help` can be used to see the help file of a specific function.

### Example: Getting help for mean function in R

Use the following command to get help on `mean` function.

`help(mean)`

You will get the following Output explaining arguments available in function and examples on how to use the function.

```Arithmetic Mean

Description:

Generic function for the (trimmed) arithmetic mean.

Usage:

mean(x, ...)

## Default S3 method:
mean(x, trim = 0, na.rm = FALSE, ...)

Arguments:

x: An R object.  Currently there are methods for numeric/logical
vectors and date, date-time and time interval objects.
Complex vectors are allowed for â€˜trim = 0â€™, only.

trim: the fraction (0 to 0.5) of observations to be trimmed from
each end of â€˜xâ€™ before the mean is computed.  Values of trim
outside that range are taken as the nearest endpoint.

na.rm: a logical value indicating whether â€˜NAâ€™ values should be
stripped before the computation proceeds.

...: further arguments passed to or from other methods.

Value:

If â€˜trimâ€™ is zero (the default), the arithmetic mean of the values
in â€˜xâ€™ is computed, as a numeric or complex vector of length one.
If â€˜xâ€™ is not logical (coerced to numeric), numeric (including
integer) or complex, â€˜NA_real_â€™ is returned, with a warning.

If â€˜trimâ€™ is non-zero, a symmetrically trimmed mean is computed

with a fraction of â€˜trimâ€™ observations deleted from each end
before the mean is computed.

References:

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S

â€˜weighted.meanâ€™, â€˜mean.POSIXctâ€™, â€˜colMeansâ€™ for row and column
means.
Examples:

x <- c(0:10, 50)
xm <- mean(x)
c(xm, mean(x, trim = 0.10))
```

### help.search Function

Use the function `help.search` to list help files that contain a certain word. Use the following command to get help on word “linear regression”.

`help.search("linear regression")`

You will get the following Output

```Help files with alias or concept or title matching â€˜linear regressionâ€™
using fuzzy matching:

datasets::anscombe Anscombe's Quartet of 'Identical' Simple Linear
Regressions
KernSmooth::dpill Select a Bandwidth for Local Linear Regression
Concepts: Non-linear Regression
MASS::rms.curv Relative Curvature Measures for Non-Linear
Regression
Concepts: Non-linear Regression
stats::D Symbolic and Algorithmic Derivatives of Simple
Expressions
Concepts: Non-linear Regression
stats::getInitial Get Initial Parameter Estimates
Concepts: Non-linear Regression
stats::nlm Non-Linear Minimization
Concepts: Non-linear Regression
stats::nls Nonlinear Least Squares
Concepts: Non-linear Regression
stats::nls.control Control the Iterations in nls
Concepts: Non-linear Regression
stats::optim General-purpose Optimization
Concepts: Non-linear Regression
stats::plot.profile.nls
Plot a profile.nls Object
Concepts: Non-linear Regression
stats::predict.nls Predicting from Nonlinear Least Squares Fits
Concepts: Non-linear Regression
stats::profile.nls Method for Profiling nls Objects
Concepts: Non-linear Regression
stats::vcov Calculate Variance-Covariance Matrix for a
Fitted Model Object
Concepts: Non-linear Regression

Type â€™help(FOO, package = PKG)â€™ to inspect entry â€™FOO(PKG) TITLEâ€™.```

Each package in R comes up with manual which can be accessed from R or can be read from CRAN.

Previous articleLearn Data analysis in R
Author and Assistant Professor in Finance, Ardent fan of Arsenal FC. Always believe "The only good is knowledge and the only evil is ignorance - Socrates"
Subscribe
Notify of