Create a function to run your analysis once on a sample of your data&lt;/h3&gt; 

.small[

```r
fit_ipw &lt;- function(split, ...) { 
  .df &lt;- analysis(split) 
  
  # fit propensity score model
  propensity_model &lt;- glm(
    exposure ~ confounder_1 + confounder_2 + ...
    family = binomial(), 
    data = .df
  )
  
  # calculate inverse probability weights
  .df &lt;- propensity_model %&gt;% 
    augment(type.predict = "response", data = .df) %&gt;% 
    mutate(wts = 1 / ifelse(exposure == 0, 1 - .fi