From ba23c578263a5d3b3067f1283ca4ccb5e8630151 Mon Sep 17 00:00:00 2001 From: Clare <chorscroft@users.noreply.github.com> Date: Fri, 10 Jul 2020 05:37:34 +0100 Subject: [PATCH] Added a new helper function for comparing a value to a vector of doubles --- R/equal_vector.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 R/equal_vector.R diff --git a/R/equal_vector.R b/R/equal_vector.R new file mode 100644 index 0000000..f7a48a3 --- /dev/null +++ b/R/equal_vector.R @@ -0,0 +1,17 @@ + +## Compares a vector to a value and returns a vector of logical values +## +## @param vector The vector to be compared to the value +## @param value The value each item in the vector should be compared to +## +## @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)) +} + + + -- GitLab