Skip to content

Commit 5c13e43

Browse files
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
1 parent e98af24 commit 5c13e43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: R/MXLX.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MXLX = function(Y = NULL, X = 5, epochSize = 1, tseg = c(0, 24), resolutionMin =
1616
nEpochsPerStep = (resolutionMin * 60) / epochSize # number of epochs per step
1717
if (do.MXLX == TRUE) { # only do the analysis if Y has values other than zero
1818
Y = Y[((((tseg[1] - tseg[1]) * 3600)/epochSize) + 1):(((tseg[2] - tseg[1]) * 3600)/epochSize)]
19-
Nwindows = Nwindows * nStepsPerHour
19+
Nwindows = ceiling(Nwindows * nStepsPerHour)
2020
rollingMean = matrix(NA, Nwindows, 1)
2121
for (hri in 1:Nwindows) { #e.g.9am-9pm
2222
# start and end in terms of steps

0 commit comments

Comments
 (0)