From c4ac47bb7a1319023ff4fcf79b48f484c5232c42 Mon Sep 17 00:00:00 2001 From: Juan Pablo Date: Sun, 15 Dec 2024 23:04:07 -0500 Subject: [PATCH] redundant if statement in de/motivate functions --- R/bard.bits.R | 11 +++++++---- R/demotivate.R | 8 ++++---- R/motivate.R | 9 +++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/R/bard.bits.R b/R/bard.bits.R index 4201217..1b6e320 100644 --- a/R/bard.bits.R +++ b/R/bard.bits.R @@ -48,17 +48,20 @@ bard.bits <- function(cat, valid_cats, several.ok = FALSE) - if(missing(seed)){ + + if (missing(seed)) { set.seed(NULL) + } else { - if (is.numeric(seed)){ - set.seed(seed) + if (!is.numeric(seed)) { + + seed <- set.char.seed(seed) } - seed <- set.char.seed(seed) set.seed(seed) } + if(cat == "any"){ adjs <- rbind(shake_adjectives,shake_clrs, dsm_5) one_adj <- sample(unique(adjs$values),1) diff --git a/R/demotivate.R b/R/demotivate.R index b386578..912adb2 100644 --- a/R/demotivate.R +++ b/R/demotivate.R @@ -37,15 +37,15 @@ demotivate <- function(cat = "any", valid_cats, several.ok = FALSE) - if(missing(seed)){ + if (missing(seed)) { set.seed(NULL) + } else { + if (!is.numeric(seed)) { - if (is.numeric(seed)){ - set.seed(seed) + seed <- set.char.seed(seed) } - seed <- set.char.seed(seed) set.seed(seed) } diff --git a/R/motivate.R b/R/motivate.R index 7b55218..2622045 100644 --- a/R/motivate.R +++ b/R/motivate.R @@ -40,14 +40,15 @@ motivate <- function(cat = "any", valid_cats, several.ok = FALSE) - if(missing(seed)){ + if (missing(seed)) { set.seed(NULL) + } else { - if (is.numeric(seed)){ - set.seed(seed) + if (!is.numeric(seed)) { + + seed <- set.char.seed(seed) } - seed <- set.char.seed(seed) set.seed(seed) }