From f6fc5a050442c60d74a1943fa1181b8338322f30 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 12 Nov 2020 16:41:10 +0100 Subject: Model names in lrtest.mmkin, fix for print.mmkin Fix the display of warnings and errors in print.mmkin, the matrix was erroneously transposed. --- R/lrtest.mkinfit.R | 2 ++ R/mmkin.R | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/lrtest.mkinfit.R b/R/lrtest.mkinfit.R index c3f4d38e..cf07154c 100644 --- a/R/lrtest.mkinfit.R +++ b/R/lrtest.mkinfit.R @@ -74,5 +74,7 @@ lrtest.mkinfit <- function(object, object_2 = NULL, ...) { #' @export lrtest.mmkin <- function(object, ...) { if (nrow(object) != 2 | ncol(object) > 1) stop("Only works for a column containing two mkinfit objects") + object[[1, 1]]$mkinmod$name <- rownames(object)[1] + object[[2, 1]]$mkinmod$name <- rownames(object)[2] lrtest(object[[1, 1]], object[[2, 1]]) } diff --git a/R/mmkin.R b/R/mmkin.R index f3c07e42..96453e1d 100644 --- a/R/mmkin.R +++ b/R/mmkin.R @@ -98,6 +98,8 @@ mmkin <- function(models = c("SFO", "FOMC", "DFOP"), datasets, model_index <- w[1] dataset_index <- w[2] res <- try(mkinfit(models[[model_index]], datasets[[dataset_index]], ...)) + if (!inherits(res, "try-error")) res$mkinmod$name <- names(models)[model_index] + return(res) } if (is.null(cluster)) { @@ -156,8 +158,7 @@ print.mmkin <- function(x, ...) { all_summary_warnings <- character() sww <- 0 # Counter for Shapiro-Wilks warnings - x_t <- t(x) # To make lapply work by rows - display <- lapply(x_t, + display <- lapply(x, function(fit) { if (inherits(fit, "try-error")) return("E") sw <- fit$summary_warnings -- cgit v1.2.1