remove.terms | R Documentation |
Remove terms from a formula
remove.terms(formula, remove, check = TRUE)
formula |
The formula. |
remove |
A vector of terms to remove. To remove terms nested inside random-effect groups, use ‘(term|group)’ syntax. Note that marginality is respected, i.e. no effects will be removed if they participate in a higher-order interaction, and no fixed effects will be removed if a random slope is included over that fixed effect. |
check |
A logical indicating whether effects should be checked for marginality. If |
library(buildmer)
remove.terms(Reaction ~ Days + (Days|Subject),'(Days|Subject)')
# illustration of the marginality checking mechanism:
# this refuses to remove the term:
remove.terms(Reaction ~ Days + (Days|Subject),'(1|Subject)')
# so does this, because marginality is checked before removal:
remove.terms(Reaction ~ Days + (Days|Subject),c('(Days|Subject)','(1|Subject)'))
# but it works with check=FALSE
remove.terms(Reaction ~ Days + (Days|Subject),'(1|Subject)',check=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.