[R] Trying to learn how to write an "advanced" function
jr@| @end|ng |rom po@teo@no
Thu Mar 16 13:42:07 CET 2023
On 2023-03-16 12:11 +0000, Sorkin, John wrote:
> (1) can someone point me to an
> explanation of match.call or match
> that can be understood by the
the man page ?match tells us that match
matches the first vector against the
second, and returns a vector of indecies
the same length as the first, e.g.
> match(c("formula", "data", "subset", "weights", "na.action", "offset"), c("Maryland", "formula", "data", "subset", "weights", "na.action", "offset", "Sorkin", "subset"), 0L)
 2 3 4 5 6 7
perhaps a bad answer ...
> (2) can someone point me to a document
> that will help me learn how to write
> an "advanced" function?
Perhaps the background here is looking
at the lm function as a basis for
writing something more advanced, then
the exercise becomes looking at
dput(lm), understanding every line by
looking up all the functions you do not
understand in the man pages e.g. ?match.
Remember, you can search for things
inside R by using double questionmark,
??match, finding versions of match
existing inside other installed
packages, e.g. raster::match and
posterior::match, perhaps this exercise
becomes writing ones own version of lm
inside ones own package?
More information about the R-help