# Small example: Compute classical Gower for a simulated data frame
df <- data.frame(
height = c(170, 160, 180),
gender = factor(c("M", "F", "M")),
smoker = c(1, 0, 1)
)
# Compute Gower dissimilarities automatically detecting types
dbrobust::dist_mixed(df)
# Manual type specification
cont_cols <- "height"
cat_cols <- NULL
bin_cols <- c("gender","smoker")
dbrobust::dist_mixed(
x = df,
continuous_cols = cont_cols,
categorical_cols = cat_cols,
binary_cols = bin_cols
)
Run the code above in your browser using DataLab