From ddbe1c81251b2ee8e48b53c1f1cdcde1b34a48f0 Mon Sep 17 00:00:00 2001 From: tappek <77916431+tappek@users.noreply.github.com> Date: Sat, 28 Dec 2024 00:15:56 +0100 Subject: [PATCH] same as prev. commit but coding is more elegant --- R/est_gmm.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/est_gmm.R b/R/est_gmm.R index cd50ca7..970524c 100755 --- a/R/est_gmm.R +++ b/R/est_gmm.R @@ -710,8 +710,9 @@ extract.data <- function(data, as.matrix = TRUE){ X <- cbind(data[[1L]], X) colnames(X)[1L] <- deparse(trms[[2L]]) } - data <- if(!as.matrix) collapse::rsplit(as.data.frame(X), index[[1L]], simplify = FALSE) - else collapse::rsplit(X, index[[1L]], simplify = FALSE) + + if(!as.matrix) X <- as.data.frame(X) + data <- collapse::rsplit(X, index[[1L]], simplify = FALSE) time <- collapse::gsplit(index[[2L]], index[[1L]]) data <- mapply( function(x, y){