The following code produces an N column of "N" and "Event N" as part of the univariate regression table. I have a case control dataset and I would like to have the columns "Cases" and "Controls" giving the numbers of cases and controls instead.
The "cases" and "control" are in determined by the variable "response" in the code below. e.g. response(1) = "cases", while response(0) = "controls".
How can I do this?
thanks, nelly
tbl_uv_nevent_ex <-
trial[c("response", "trt", "age", "grade")] %>%
tbl_uvregression(
method = glm,
y = response,
method.args = list(family = binomial)
) %>%
add_nevent()
You can do this by adding the number of controls to the
.$table_body
data frame. I've included an example below. There is a sticking point at the moment....after you add the number of controls to the data frame that will be printed, we need to add the new column to the internal set of instructions to print in gtsummary. This step is a headache now, but we're working on a solution to make it accessible to users. Here is the first draft of that function: http://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_header.htmlIn the meantime, here's how you can get that done: