From 5b92147287011d0b53dcce05d16309045f10233f Mon Sep 17 00:00:00 2001 From: Clare <chorscroft@users.noreply.github.com> Date: Wed, 29 Jul 2020 15:49:09 +0100 Subject: [PATCH] Change code to be more efficient --- R/equal_vector.R | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/R/equal_vector.R b/R/equal_vector.R index f7a48a3..154ca92 100644 --- a/R/equal_vector.R +++ b/R/equal_vector.R @@ -6,12 +6,7 @@ ## ## @return A vector of TRUE and FALSE values ## + equal_vector <- function(vector, value){ - tempFunction<-function(x,value){ - isTRUE(all.equal(x,value)) - } - return(sapply(vector,tempFunction,value)) + return(abs(vector-value)<.Machine$double.eps^0.5) } - - - -- GitLab