So, you want to have "yes" and "no" columns that total each row, but also add two additional rows for "yes" and "no?" It's starting to be a non-ideal structure for a typical data frame, but it's doable (if I'm understanding correctly):
# The base tibble with the yes/no totals calculated by row
df2 <-tibble(Survival = sample(c(0,1), replace = TRUE, size=470),
PainB4 = sample(c(0,1), replace = TRUE, size=470),
Haem = sample(c(0,1), replace = TRUE, size=470),
Dysp = sample(c(0,1), replace = TRUE, size=470),
Cough = sample(c(0,1), replace = TRUE, size=470),
Weak = sample(c(0,1), replace = TRUE, size=470),
DM = sample(c(0,1), replace = TRUE, size=470),
HeartA = sample(c(0,1), replace = TRUE, size=470),
Periph = sample(c(0,1), replace = TRUE, size=470),
Smoke = sample(c(0,1), replace = TRUE, size=470),
Asthma = sample(c(0,1), replace = TRUE, size=470)) %>%
# Caclculate the total yes and no for each row
mutate(yes = rowSums(.), no = ncol(.) - rowSums(.)) %>%
# move yes and no to be the first columns
relocate(yes, no)
# Make a data frame that totals up each column and has a row for "yes"
# and a row for "no." We'll make the "yes" total and then back into the "no"
# total.
# Make the "yes" row
summary_df <- tibble(summarise(df2, across(everything(), sum)))
# Add a "no" row by subtracting the yes row from the total rows in df2. This will
# make non-sensical counts for "yes" and "no" column totals in the second row. We'll
# address that next
summary_df <- summary_df %>%
bind_rows(nrow(df2) - summary_df[1,])
# We'll shuffle things around so the "total totals" are NA for the yes/no cells.
summary_df$yes[2] <- NA
summary_df$no[2] <- summary_df$no[1]
summary_df$no[1] <- NA
# Add the summary rows to the original df2
df2 <- df2 %>%
bind_rows(summary_df)
# Remove the temporary summary_df
rm(summary_df)
If you go to the very bottom of the data frame, you should see two rows added. the "yes" and "no" values for those two rows should total up both for the row and the column.