Skip to content

Commit

Permalink
Ceil to prevent matrix from creating not enough rows
Browse files Browse the repository at this point in the history
ceil because machine precision can sometimes cause matrix() to create a value less than what we want, somehow I missed this in #1228
  • Loading branch information
vincentvanhees committed Nov 22, 2024
1 parent e98af24 commit 5c13e43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/MXLX.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c13e43

Please sign in to comment.