From ffdcc59053b5aa2e8e722ae4b4ace86d80f0ad3c Mon Sep 17 00:00:00 2001 From: mrvillage Date: Wed, 19 Jun 2024 14:58:05 -0400 Subject: [PATCH] If there's no outcome column name, use the index --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8b63dbd..b709997 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,7 +87,8 @@ pub fn calculate_r2s<'a>( } r.outcome = colnames .as_ref() - .and_then(|c| c.get(j).map(|c| c.to_string())); + .and_then(|c| c.get(j).map(|c| c.to_string())) + .unwrap_or(j.to_string()); r }) .collect::>();