I have a little tibble that looks like
library(magrittr)
library(tidyverse)
summaryTable <- tibble(admit = c(0,0,1,1),
female = c(0,1,0,1),
average = c(3.31, 3.36, 3.59, 3.59))
summaryTable %>% print()
#> # A tibble: 4 × 3
#> admit female average
#> <dbl> <dbl> <dbl>
#> 1 0 0 3.31
#> 2 0 1 3.36
#> 3 1 0 3.59
#> 4 1 1 3.59
Created on 2022-05-13 by the reprex package (v2.0.1)
I would like to make this into a two-by-two table with admit giving the rows, female the columns, and average the cell values. This must be an application of pivot_wider(), but I'm not seeing it.