Closed Beduiz closed 2 years ago
Hi Eric,
If I understand correctly, then you should exclude those rows before calling the table1()
function (e.g. using subset()
for instance). That way, they won't be included in the table at all (i.e., it's like they never existed). Does that make sense? Here's an example:
library(table1)
set.seed(123)
s <- function(n) sample(c(LETTERS[1:3], NA), n, replace=T)
d <- data.frame(x=s(100), y=s(100), z=s(100))
# Missing values included
table1(~ x + y | z, data=d)
# Missing values excluded
d2 <- subset(d, !is.na(z))
table1(~ x + y | z, data=d2)
Hi Benjamin,
Oh yes, you are completely right. I should just exclude those values from the dataset beforehand. I should have figured. Thank you for the help!
Best regards Eric
Hi Benjamin,
When the variable for the table columns includes NA:s, those NA:s are included in the total count of the Overall column even though they aren't included in the rest of the table. Is there a way to exclude NA:s from the count of the overall column?
(I'm checking first if this is an issue you know of, but if not let me know and i will try to add a working example)
/Eric