How to Get Help on Functions in R?

Spread the love

In this post you will learn how to get help on functions in R.

Getting Help on Functions –

There are many functions and it is impossible to remember each of them. Whenever you need help with any function in R, you can use

help(funtionName)

Let’s say you want to know about the mean function. To do that you have to write

> help(mean)

When you type the above code, this will open the help page for the mean function in the help pane in RStudio.

There is also a shortcut method to get help on a function. Simply type ? followed by the name of the function.

> ?mean

Sometimes you may also want to know the arguments of the function. To do that you can use the args function.

> args(mean)
function (x, ...) 
NULL

Some time knowing the arguments is not enough and you want to know how to use a function. For that you can use example function.

> example(mean)

mean> x <- c(0:10, 50)

mean> xm <- mean(x)

mean> c(xm, mean(x, trim = 0.10))
[1] 8.75 5.50

Rating: 1 out of 5.

Posted in RTagged

Leave a Reply