Struggling with gtsummary and "empty" data

38 views Asked by At

I am struggling with gtsummary. Essentially I am trying to make a table with 2 different variables, one is organism one is resistance markers. Currently both of these variables are character variables. When I made them factor variables it made the table even worse.

I am only trying to include certain organisms which I have already assigned to a vector. As my graph currently looks it is including the correct organisms.

My problem is that there is a column which is labelled ****. This column is essentially counting the organisms without any resistance markers. Those cells in the spreadsheet are just empty.

My questions:

  1. Is it possible to delete the column with ****, i think I can show the rest of the data ok without that column
  2. Could i rename the column to Nil detected? I have tried to use (modify_header(**** = "Nil detected"). But this didnt work. I tried replacing the one entitled CPE in case it was an issue with it being special characters but that didnt help.
GNRs_resistance %>% 
  filter(Organism %in% gramnegativerods) %>% 
  tbl_summary(include= c(Organism, Resistance.markers),
              by = Resistance.markers,
              statistic = Organism ~ "{n} ({p}%)") %>% 
  add_overall() %>% 
  modify_header(all_stat_cols() ~ "**{level}**<br>n = {n}")

[enter image description here] (https://i.stack.imgur.com/dfbzr.png)

0

There are 0 answers