The autor doesn't make it clear but that is a user defined function, it is not part of the MASS package. If you look into the referenced github repository you can find how the function is defined
setData <- function(df, resp, makeFactorResp = FALSE) {
if (makeFactorResp) { # if resp should be a factor but is not one
df[[resp]] <- factor(df[[resp]])
isFactorResp <- TRUE
}
num_classes <- NA
if (any(class(df[[resp]]) == "factor")) {
num_classes <- length(levels(factor(df[[resp]])))
}
respCol = getRespCol(df, resp)
ptype <- if (is.numeric(df[[resp]])) { "regression" } else { "classification"}
df.e <- list(dt.frm = df
, resp = resp
, num_classes = num_classes
, vars = names(df)[-respCol]
, vars_fac = sapply(df[-respCol], function(j) { any(class(j) == "factor") } )
, respCol = respCol
, ptype = ptype
)
class(df.e) <- "df.enum"
return(df.e)
}
The code in this article is not reproducible so you shouldn't take it as a step by step guide.