readAxivity(start = n - 1, end = n), where n is the number of data blocks, fails with:
object 'prevStart' not found
That range asks for exactly one block, the final one. Any range starting earlier works, including a full read.
Reproducible example
library(GGIRread)
f <- system.file("testfiles/ax3_testfile.cwa", package = "GGIRread")
n <- (file.info(f)$size - 1024) / 512 # 145 data blocks
readAxivity(f, start = n - 3, end = n, progressBar = FALSE) # ok, 362 rows
readAxivity(f, start = n - 1, end = n, progressBar = FALSE) # Error: object 'prevStart' not found
Same on ax6_testfile.cwa, 283 blocks, start = 282, end = 283.
R 4.5.2, Windows.
Cause
Previously there's a check to prevent this, open 0522630 then search the following:
if (prevRaw$start >= start & pos <= nr & exists("prevStart") & exists("prevLength")) {
The later refactor removed this part
Why it may matter
If chunked processing leaves exactly one block in the final chunk, GGIRread will fail
readAxivity(start = n - 1, end = n), wherenis the number of data blocks, fails with:That range asks for exactly one block, the final one. Any range starting earlier works, including a full read.
Reproducible example
Same on
ax6_testfile.cwa, 283 blocks,start = 282, end = 283.R 4.5.2, Windows.
Cause
Previously there's a check to prevent this, open
0522630then search the following:The later refactor removed this part
Why it may matter
If chunked processing leaves exactly one block in the final chunk, GGIRread will fail