From ad746f3eba274baf28580ce65d17541edb05fdbc Mon Sep 17 00:00:00 2001 From: Artem Klevtsov Date: Mon, 14 Mar 2016 07:35:09 +0600 Subject: [PATCH] Improve gather_.data.frame when na.rm = TRUE but df really haven't NAs --- R/gather.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/gather.R b/R/gather.R index 6955c52b3..ace7e6ff7 100644 --- a/R/gather.R +++ b/R/gather.R @@ -113,7 +113,7 @@ gather_.data.frame <- function(data, key_col, value_col, gather_cols, as.logical(factor_key) ) - if (na.rm) { + if (na.rm && anyNA(df)) { missing <- is.na(df[[value_col]]) df <- df[!missing, ] }