Dimensionality Reduction in R
Matt Pickard
Owner, Pickard Predictives, LLC
blood_type_df <-
expand_grid(
gender = c("Female", "Male"),
veteran = c("Yes", "No"),
bloodtype = c("A", "B", "AB", "O")
)
# A tibble: 16 × 3
gender veteran bloodtype
<chr> <chr> <chr>
1 Female Yes A
2 Female Yes B
3 Female Yes AB
4 Female Yes O
5 Female No A
6 Female No B
7 Female No AB
8 Female No O
9 Male Yes A
... ... ...
blood_type_df %>% summarize(across(everything(), ~ length(unique(.)))) %>%
prod()
16
NOTE: That's the number to represent each combination only once!
blood_type_df %>%
summarize(across(everything(), ~ length(unique(.))) %>%
prod() * 4
128
Dimensionality Reduction in R