If your question is to convert the data you have into a table form that's more aesthetically pleasing, the flextable
package may be an easy one to use. You can also get the counts of your data by using adorn_totals
by column and by row. I have tried to recreate your data below and build a table around it:
#### Load Libraries ####
library(tidyverse) # for piping
library(flextable) # for table
library(janitor) # for row and column totals
#### Use Same Data ####
ID <- c("x","y","z","w")
a <- c(1,0,0,1)
b <- c(0,0,1,1)
c <- c(0,1,1,0)
d <- c(1,1,0,0)
#### Just Use Adorn Totals ####
df <- data.frame(ID,a,b,c,d) %>%
adorn_totals("col") %>%
adorn_totals("row")
#### Flextable ####
df %>%
flextable() %>%
add_header_lines("Total by Total Version")
Which gives you this:
