Karthik Shanmukha
Karthik Shanmukha

Reputation: 427

Additional arguments in a function

How do i check for what additional arguments can be passed in a function in R. For example, i recently discovered an additional argument character.only for lapply function.

packageslist <- list('car', 'MASS')
lapply(packageslist, require, character.only = TRUE)

Upvotes: 1

Views: 1603

Answers (1)

Oriol Mirosa
Oriol Mirosa

Reputation: 2826

You can see the list of arguments with

args(function)

Notice that, when you do that for lapply, you get:

args(lapply)

function (X, FUN, ...)

Those three dots (...) mean that you can add optional arguments to the function that you pass as an argument to lapply, so there can be extra arguments that are not directly arguments for lapply.

Upvotes: 4

Related Questions