Are you new to R? You may consider using the following functions to help yourself before going to others for help.

  1. help() and ?

The help operators 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. For instance, use  ?lm to access information about the linear model. 

One can use help(package=”package name”) to  display an index of available help pages for the package along with some other information. To get information about the “datasets” package, use the following command;

However, The help() function and ? operators are useful only if you already know the name of the function that you wish to use and if the function is already loaded into the R environment. The following do a deeper search within R;

2. apropos()

This function searches for objects, including functions, directly accessible in the current R session that have names that include a specified character string. e.g

This returns the names of all accessible objects that contains the  (case-insensitive) characters “lm”

3. and ??

This works like help. You should use this when you are not sure about the name of the command you are looking for. It l brings up a list of places where your word occurs. 

It shows the places where you can get information about different kinds of plots

4. help.start()

It starts and displays a hypertext-based version of R’s online documentation in your default browser that provides links to locally installed versions of the R manuals, a listing of your currently installed packages, and other documentation resources.

The following may also be helpful;

  • install.packages()

There are now more than 10,000 R packages. A few of these packages are shipped with R. This means most of the packages will be installed as need arises. The installation is done using the install.packages(“package name”) function. Let’s illustrate this by installing the “ISwR” package.

  • library():

After successfully installing a package, to use it, it has to be loaded. This is done using the library(package name) function.

In case you want to unload a package, use detach(“package:package name”). E.g

This unloads the “ISwR” package.

  • attach() and detach()

attach()  makes the variables of a dataset available by adding the data to the search path. detach() removes the dataset from the search path. The “energy” dataset of the “ISwR” is used here to illustrate how to use these functions.

Learn More

Last modified: 9 December 2020


Write a Reply or Comment

Your email address will not be published.

Solve : *
29 × 1 =