From d503dc2e5b6ae52fb9e5eb68f26fcf7ffc2ebc75 Mon Sep 17 00:00:00 2001
From: unknown <isabelle.sanchez@inra.fr>
Date: Fri, 3 Jun 2022 10:11:21 +0200
Subject: [PATCH] MaJ issue #12 rems 2/ et 3/

---
 R/kfino.R        | 20 ++++++++++++++++----
 man/kfino_fit.Rd | 15 ++++++++++++---
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/R/kfino.R b/R/kfino.R
index b02e62c..9fce17e 100644
--- a/R/kfino.R
+++ b/R/kfino.R
@@ -54,9 +54,18 @@
 #' @return a S3 list with two data frames and a list of vectors of
 #' kfino results
 #' \describe{
-#' \item{detectOutlier}{The whole dataset with the detected outliers flagged
-#'                      and prediction}
-#' \item{PredictionOK}{A dataset with the predictions on possible values}
+#' \item{detectOutlier}{The whole input data set with the detected outliers 
+#'                      flagged and prediction}
+#'  \describe{
+#'   \item{prediction}{the parameter of interest - Yvar - predicted}
+#'   \item{label_pred}{the probability of the value being well predicted}
+#'   \item{lwr}{lower bound of the confidence interval of the predicted value}
+#'   \item{upper}{upper bound of the confidence interval of the predicted value}
+#'   \item{flag}{flag of the value (OK value, KO value (outlier), OOR value
+#'               (out of range values defined by the user in `kfino_fit`)}
+#'  }
+#' \item{PredictionOK}{A dataset with the predictions on possible values (OK 
+#'                     and KO values)}
 #' \item{kfino.results}{kfino results (a list of vectors) on optimized input
 #'                      parameters or not}
 #' }
@@ -594,7 +603,9 @@ kfino_fit<-function(datain,Tvar,Yvar,
   # useful for the kfino_plot() function
   #---------------------------------------------------------------------------
   if (is.null(resultat)){
-    dt.out<-datain %>% mutate(flag=.data$flag1)
+    dt.out<-datain %>% 
+              mutate(flag=.data$flag1) %>%
+              select(-.data$flag1)
     dt.pred<-NULL
     resultat<-NULL
 
@@ -617,6 +628,7 @@ kfino_fit<-function(datain,Tvar,Yvar,
     dt.out<-mutate(dt.out,flag=if_else(.data$flag1 == "OOR",
                                        .data$flag1, .data$flag))
     dt.out<-arrange(dt.out,.data$rowNum)
+    dt.out<-select(dt.out,-.data$flag1)
 
     #--------------------------------------
     # return a S3 list object
diff --git a/man/kfino_fit.Rd b/man/kfino_fit.Rd
index f7059ec..5a346be 100644
--- a/man/kfino_fit.Rd
+++ b/man/kfino_fit.Rd
@@ -46,9 +46,18 @@ optimization, default 7}
 a S3 list with two data frames and a list of vectors of
 kfino results
 \describe{
-\item{detectOutlier}{The whole dataset with the detected outliers flagged
-                     and prediction}
-\item{PredictionOK}{A dataset with the predictions on possible values}
+\item{detectOutlier}{The whole input data set with the detected outliers 
+                     flagged and prediction}
+ \describe{
+  \item{prediction}{the parameter of interest - Yvar - predicted}
+  \item{label_pred}{the probability of the value being well predicted}
+  \item{lwr}{lower bound of the confidence interval of the predicted value}
+  \item{upper}{upper bound of the confidence interval of the predicted value}
+  \item{flag}{flag of the value (OK value, KO value (outlier), OOR value
+              (out of range values defined by the user in `kfino_fit`)}
+ }
+\item{PredictionOK}{A dataset with the predictions on possible values (OK 
+                    and KO values)}
 \item{kfino.results}{kfino results (a list of vectors) on optimized input
                      parameters or not}
 }
-- 
GitLab