2
$\begingroup$

I was wondering how to get arguments for R functions. Is there any R function which can be used to get all arguments for a certain function?

As R function glm has the following arguments

glm(formula, family = gaussian, data, weights, subset,
na.action, start = NULL, etastart, mustart, offset,
control = list(...), model = TRUE, method = "glm.fit",
x = FALSE, y = TRUE, contrasts = NULL, ...)

How these arguments can be obtained on R console? Thanks

$\endgroup$
  • $\begingroup$ If R is only tag for your question then this question is better fit on StackOverflow.com $\endgroup$ – Marek May 20 '11 at 10:12
4
$\begingroup$

You could use something like formals() or args(), e.g. formals(glm) gives:

> formals(glm)
$formula


$family
gaussian

$data


$weights


$subset


$na.action


$start
NULL

$etastart


$mustart


$offset


$control
list(...)

$model
[1] TRUE

$method
[1] "glm.fit"

$x
[1] FALSE

$y
[1] TRUE

$contrasts
    NULL
    
    $...
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.