From 5c13e43e5d5a32ecef8a531265a2d97f2de7e81b Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Fri, 22 Nov 2024 11:24:55 +0100 Subject: [PATCH] Ceil to prevent matrix from creating not enough rows ceil because machine precision can sometimes cause matrix() to create a value less than what we want, somehow I missed this in #1228 --- R/MXLX.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/MXLX.R b/R/MXLX.R index 8459d5b6f..34121317b 100644 --- a/R/MXLX.R +++ b/R/MXLX.R @@ -16,7 +16,7 @@ MXLX = function(Y = NULL, X = 5, epochSize = 1, tseg = c(0, 24), resolutionMin = nEpochsPerStep = (resolutionMin * 60) / epochSize # number of epochs per step if (do.MXLX == TRUE) { # only do the analysis if Y has values other than zero Y = Y[((((tseg[1] - tseg[1]) * 3600)/epochSize) + 1):(((tseg[2] - tseg[1]) * 3600)/epochSize)] - Nwindows = Nwindows * nStepsPerHour + Nwindows = ceiling(Nwindows * nStepsPerHour) rollingMean = matrix(NA, Nwindows, 1) for (hri in 1:Nwindows) { #e.g.9am-9pm # start and end in terms of steps