stratiply | R Documentation |
Split a data.frame
by any number of columns and apply a function to subset.
stratiply( data, f, by, ... )
data |
A |
f |
A function that takes a |
by |
A vector of quoted/unquoted columns, positions, and/or |
... |
Additional arguments passed to |
A list
Alex Zajichek
#Unquoted selection heart_disease %>% stratiply( head, Sex ) #Select helper heart_disease %>% stratiply( f = head, by = starts_with("S") ) #Use additional arguments for the function heart_disease %>% stratiply( f = glm, by = Sex, formula = HeartDisease ~ ., family = "binomial" ) #Use mixed selections to split by desired columns heart_disease %>% stratiply( f = glm, by = c(Sex, where(is.logical)), formula = HeartDisease ~ Age, family = "binomial" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.