From fc6b1247f8372efb23b1fb03b37cb7580765995d Mon Sep 17 00:00:00 2001
From: Julian Sagebiel <julian.sagebiel@idiv.de>
Date: Sat, 22 Jun 2024 03:03:48 +0200
Subject: [PATCH] add functionality to readdesign

---
 R/readdesign.R                           | 20 +++++++++++++++++++-
 tests/manual-tests/test_decisiongroups.R |  4 ++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/R/readdesign.R b/R/readdesign.R
index d512e32..699ff04 100644
--- a/R/readdesign.R
+++ b/R/readdesign.R
@@ -20,7 +20,25 @@
 
 
 
-readdesign <- function(design = designfile, designtype = destype) {
+readdesign <- function(design = designfile, designtype = NULL) {
+
+  # if (is.null(designtype)) {
+  #
+  #
+  #
+  #   # Check if the string ends with ".ngd"
+  #   if (grepl("\\.ngd$", designfile)) {
+  #     # Code to execute if condition is true
+  #     designtype = "ngene"
+  #     print("I guessed it is an ngene file")
+  #   } else {
+  #     # Code to execute if condition is false
+  #     designtype = "spdesign"
+  #     print("I assume it is a spdesign")
+  #   }
+  #
+  # }
+
   design <- switch(designtype,
                    "ngene" = suppressWarnings(readr::read_delim(design,
                                                                 delim = "\t",
diff --git a/tests/manual-tests/test_decisiongroups.R b/tests/manual-tests/test_decisiongroups.R
index 76c3511..147a736 100644
--- a/tests/manual-tests/test_decisiongroups.R
+++ b/tests/manual-tests/test_decisiongroups.R
@@ -256,9 +256,9 @@ apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimat
 # ################################################################# #
 
 ### Optional starting values search
-# apollo_beta=apollo_searchStart(apollo_beta, apollo_fixed,apollo_probabilities, apollo_inputs)
+apollo_beta=apollo_searchStart(apollo_beta, apollo_fixed,apollo_probabilities, apollo_inputs)
 
-model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs ,estimate_settings =list(estimationRoutine="bhhh" , hessianRoutine= "maxLik"))
+model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs ) #,estimate_settings =list(estimationRoutine="bhhh" , hessianRoutine= "maxLik")
 
 # ################################################################# #
 #### MODEL OUTPUTS                                               ####
-- 
GitLab