From bfaee2d29204bc27e8638f87941ab960946675ea Mon Sep 17 00:00:00 2001 From: Yilong Zhang Date: Fri, 12 Jul 2024 05:13:38 +0000 Subject: [PATCH] bug fix: keep factor rows with completely missing values --- R/collect_n_subject.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/R/collect_n_subject.R b/R/collect_n_subject.R index 6e94893..c109f17 100644 --- a/R/collect_n_subject.R +++ b/R/collect_n_subject.R @@ -272,7 +272,10 @@ collect_n_subject <- function(meta, # standardize categorical variables if (any(c("factor", "character") %in% class_var)) { - var <- factor(var, exclude = NULL) + + if (any(c("character") %in% class_var)) { + var <- factor(var, exclude = NULL) + } if (all(is.na(var))) { levels(var) <- c(levels(var), title["missing"])