Reputation: 3943
The help file for lm is here: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/lm.html or you can do ?lm. Some parameters are specified as optional while others are not. Yet I find:
r=x~y
x=1:10
y=1:10*2
lm(r)
works fine. How can I interpret what's required and what's actually optional?
Upvotes: 1
Views: 71
Reputation: 263301
The combination of looking at the Usage and Arguments sections usually suffices:
lm(formula, data, subset, weights, na.action,
method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE,
singular.ok = TRUE, contrasts = NULL, offset, ...)
Every named argument before the triple dots except arguably offset
is either mentioned in the Details as having a default or is listed in the Usage as being assigned a default value. Any value beyond the triple dots in an argument list is automatically not required. You can also look at the code. In the case of offset
it is clear from this line that a NULL value is acceptable:
if (!is.null(offset)) {
Upvotes: 3