With your data:
library(tidyverse)
df <- tibble::tribble(
~gender, ~last_quantitative_lab_value, ~viral_suppression_numeric,
"Male", 20L, 0L,
"Male", 20L, 0L,
"Male", 20L, 0L,
"Male", 22L, 0L,
"Male", 20L, 0L,
"Female", 20L, 0L,
"Male", 20L, 0L,
"Male", 20L, 0L,
"Transgender", 1490L, 1L,
"Female", 1000L, 1L,
"Male", 20L, 0L,
"Male", 205L, 1L,
"Male", 20L, 0L,
"Male", 22L, 0L,
"Male", 208L, 1L,
"Female", 20L, 0L,
"Female", 201L, 1L,
"Female", 207L, 1L,
"Transgender", 20L, 0L,
"Female", 1000L, 1L
)
df %>%
group_by(gender) %>%
count(viral_suppression_numeric) %>%
mutate(prop = n/sum(n))
# A tibble: 6 × 4
# Groups: gender [3]
gender viral_suppression_numeric n prop
<chr> <int> <int> <dbl>
1 Female 0 2 0.333
2 Female 1 4 0.667
3 Male 0 10 0.833
4 Male 1 2 0.167
5 Transgender 0 1 0.5
6 Transgender 1 1 0.5
For making it reproducible next time: