I'm reading through a tutorial that is using the lme4
package and one of the input options to predict
is re.form=Na
.
m_lmer <- lmer(log(beakh) ~ log(wingl) + (1 | taxon), data = d)
d$predict_lmer_population <- predict(m_lmer, re.form = NA)
I want to get help for the predict
call, but clearly doing ?predict
is incorrect.
I then tried asking for the class of the model:
> class(m_lmer)
[1] "lmerMod"
attr(,"package")
[1] "lme4"
I then tried ?lmerMod
which RStudio automagically changed to ?`lmerMod-class`
. I get the addition of `
to the name because of the -
"special character" but where did class
come from?
The help then describes the "merMod" class, not "lmerMod". Why the name change (leading l dropped)?
After some searching in that help I found a link to predict.merMod
Further searching confirmed I could have done: methods('predict')
and found the same method, although it is listed predict.merMod*
for some reason (added * symbol).
In the end I feel like I would be able to find something similar much more quickly the next time but it still seems very hard to find good help for class methods in R. I'm not sure if this would work the same for S4 or R6 (from the documentation it seems predict.merMod
is a S3 method)? It is not clear why the l
was dropped from the class name (lmerMod
to merMod
) or why the -class
suffix is needed when asking for help. I feel like I'm missing some extremely basic lesson on R documentation.
Throwing this "help in R" link in for reference that seems to omit class based methods help and also seems like it should just point to some official R documentation website rather than being such a long SO post ... How to get help in R?