How do I bootstrap with logistic regression

This line assigns to an object to be named d2 a subset of object d (a data frame or matrix or some other object with rows and columns so that there are two dimensions) that consists of the ith row of d and all columns.

But that's a how detail and it's only useful to know after understanding what.

Let's relate d to the textual description. Because d is being subset, we know thatit is data frame or matrix (the main difference is that a data frame can have both numeric and character variables but a matrix must have all one or the other). The text describes something with two objects (think of everything in R as an object) termed Eating out and Geographic location. The latter is identified as a variable, meaning a column, and the former isn't, but won't fit unless it is. n= tells us this is count data and we'll see this is in the realm of discrete data, which has important differences from continuous data that can, in theory, take on an infinite number of different values between integers. But you can't have half a Never.

Usually, this is as far as I'd take it without a a reprex (see the FAQ), but it's a slow night.

d <- data.frame(
  dine = sample(as.factor(c(rep("never",641),rep("weekly",308),rep("daily",24))),973),
  geo = c(rep(1,51),rep(0,922))
)

tab <- table(d)
attributes(tab)$dimnames$geo <- c("sm","lg")
prop.table(tab) 
#>         geo
#> dine              sm          lg
#>   daily  0.023638232 0.001027749
#>   never  0.626927030 0.031860226
#>   weekly 0.297019527 0.019527235

Created on 2023-06-28 with reprex v2.0.2

Come back with a new question including a a reprex (see the FAQ) for help when you get to the regression part. Also, see the homework FAQ, if applicable.