I have a dataset as below. When I make a table1 from it using table1(), there is a row given for missing values. I was wondering if it is possible to exclude the 'missing row' from one of the variables (say var3).
The reason I want to do this is because, in my actualy dataset, I have a variable length of hospital stay. Not all the individuals in the dataset are in hospital, so these patients don't have missing data, they just don't have data for this variable as they weren't in the hospital to provide it.
Any help would be appreciated, thanks.
data <- data.frame(
var1 = c(1, 2, NA, 4, 5),
var2 = c("A", "B", NA, "D", "E"),
var3 = c(10, NA, 30, 40, 50)
)
table1(~var1 + var2 + var3, data=data)
Use render.missing = NULL
(which is not in the help (?table1::table1
) for some reason!):
table1::table1(~var1 + var2 + var3, data=data, render.missing = NULL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With