[R] Trying to learn how to write an "advanced" function

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


I am trying to understand how to write an "advanced" function. To do so, I am examining the lm fucnction, a portion of which is pasted below. I am unable to understand what match.call or   match does, and several other parts of lm, even when I read the help page for match.call or match. 
(1) can someone point me to an explanation of match.call or match that can be understood by the uninitiated? 
(2) can someone point me to a document that will help me learn how to write an "advanced" function?

Thank you,
John

> 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