PreProcessing and resampling using #TidyTuesday college data

Hi, guys

I was trying to reproduce one dataset of mine using this example posted on YouTube: https://www.youtube.com/watch?time_continue=3&v=s3TkvZM60iU&feature=emb_title.

And the last part of the code I had an error, and I'm having trouble how to solved it, follow the code which I received the error:

I figured out how to do it, now I'm trying to run this part of the code:

glm_fit %>%
predict(
new_data = bake(uni_prep, uni_test)
type = "prob"
) %>%
mutate(truth = uni_test$diversity) %>% **#just change this part with my variables** 
roc_auc(truth, .pred_high) **# just change this part with my variables**

And received this error:

Error: Problem with `summarise()` input `.estimate`.
x `truth` should be a factor but a character was supplied.
ℹ Input `.estimate` is `metric_fn(...)`.

Could you help with this issue?

What is the results of

str(uni_test$diversity)

It should be a factor with the same levels as your predicted class.