NESTFH2<-data.frame(FH=c(rep(1,20),rep(0,20)),
Diagnosis.=c(rep(1,12),rep(0,28)),
Strabismus.=c(rep(1,12),rep(0,28)),
Amblyopia.=c(rep(1,12),rep(0,28)),
Glasses.=c(rep(1,12),rep(0,28))) #created some data
NESTFH2.withlabs <- apply_labels(NESTFH2,
FH = "FH",
FH = c("Yes" = 1, "No" = 0),
Diagnosis.= "Diagnosis", # the group name
Diagnosis. = c("Yes" = 1,"No" = 0), # the label within that group
Strabismus.= "Strabismus",
Strabismus.= c("Yes" = 1,"No" = 0),
Amblyopia. = "Amblyopia",
Amblyopia.= c("Yes" = 1,"No" = 0),
Glasses. = "Glasses",
Glasses.= c("Yes" = 1,"No" = 0)) #apply the label you want and store with a new name
NESTFH2 %>% tab_cells(FH) %>% tab_cols(Diagnosis.,Strabismus.,Amblyopia.,Glasses.) %>% tab_stat_cases() %>% tab_pivot() # your orginal attempt
NESTFH2.withlabs %>% tab_cells(FH) %>% tab_cols(Diagnosis.,Strabismus.,Amblyopia.,Glasses.) %>% tab_stat_cases() %>% tab_pivot() #your desired outcome
cro_cases(NESTFH2.withlabs$FH, list(total(),NESTFH2.withlabs$Diagnosis., NESTFH2.withlabs$Strabismus.,NESTFH2.withlabs$Amblyopia.,NESTFH2.withlabs$Glasses.)) #labelling above should now help with the send part of your question