[R] Trying to learn how to write a function

Sorkin, John j@ork|n @end|ng |rom @om@um@ry|@nd@edu
Thu Mar 16 13:05:39 CET 2023

I am trying to understand how to write an "advanced" function. To do this, I am examining the code of lm, a small part of the lm code is below. N

> lm
function (formula, data, subset, weights, na.action, method = "qr", 
    model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, 
    contrasts = NULL, offset, ...) 
    ret.x <- x
    ret.y <- y
    cl <- match.call()
    mf <- match.call(expand.dots = FALSE)
    m <- match(c("formula", "data", "subset", "weights", "na.action", 
        "offset"), names(mf), 0L)

More information about the R-help mailing list