Description Usage Arguments Details Value See Also Examples
Drop predictor variables according to a (regex) pattern
1 | drop_pattern(form, pattern, ...)
|
form |
a formula object |
pattern |
predictors matching this pattern will be dropped |
... |
further arguments passed on to |
form
is divided into its individual terms, any term matching
pattern
is removed, before form
is updated and returned.
In case no match is made, form
is returned unmodified.
In case all predictors match, only the intercept is retained.
In any case the response variable(s) are kept as is.
A formula object
1 2 3 4 5 6 7 8 9 10 11 12 | f6 <- y ~ aa*bb + aa + ac + cc + acab
drop_pattern(f6, "a") # Drop all containing a
drop_pattern(f6, "a{2}") # Drop all containing exactly 2 consecutive as
drop_pattern(f6, "^[^a]*a[^a]*$") # All containing exactly 1 a
drop_pattern(f6, ":") # Drop interaction
drop_pattern(f6, "^[^:]*a[^:]*$") # Drop all containg a, but not interaction
drop_pattern(f6, "^((?!a).)*$", perl=TRUE) # Drop all not containing a
# Degenerate cases
drop_pattern(f6, "[abc]") # Drop all
drop_pattern(f6, "q") # Drop none
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.