Open Chinate opened 2 days ago
I'm going to jump in to give Vincent a break.
The clue (as always) is in the error message:
cannot open compressed file 'out//meta/basic/meta_mydata.csv.RData', probable reason 'No such file or directory'"
R is trying to save a file to a directory that does not exist. Why doesn't it exist? Well, in g.part1 GGIR checks if the top level meta data folder exists, and if it doesn't it creates it and all of the sub-directories.
https://github.com/wadpac/GGIR/blob/c19ecd334c5d8e4119af5778d9bab40f56ca4106/R/g.part1.R#L50-L56
The problem is that you have created the first directory which passes the check, but not the subsequent directories. There are two ways to solve this:
So all you would be doing is:
GGIR(
mode=c(1), # This is the same as just running g.part1
datadir="/Users/zhiyuan/Desktop/2024_8_26/Project/5/test",
outputdir="/Users/zhiyuan/Desktop/2024_8_26/Project/5/out",
...
)
Describe the bug When I try to run GGIR function for my data, an error reported from part 3 that "No milestone data found for part(s) 2.", but the problem seems to start from part 1 since "g.part1" reports "[1] "cannot open the connection" $call gzfile(file, "wb")"
To Reproduce
create mydata.csv using the same data as the example presented at the end of "https://cran.r-project.org/web/packages/GGIR/vignettes/readmyacccsv.html".
place it in directory "/Users/zhiyuan/Desktop/2024_8_26/Project/5/test", and create directory "/Users/zhiyuan/Desktop/2024_8_26/Project/5/out".
run
ggir_test <- read.myacc.csv(rmc.file = "/Users/zhiyuan/Desktop/2024_8_26/Project/5/test/mydata.csv", rmc.nrow = Inf, rmc.skip = 0, rmc.dec = ".", rmc.firstrow.acc = 2, rmc.col.acc = 2:4, rmc.col.temp = 5, rmc.col.time=1, rmc.unit.acc = "g", rmc.unit.temp = "C", rmc.unit.time = "POSIX", rmc.format.time = "%d/%m/%Y %H:%M:%OS", desiredtz = "Europe/London", rmc.sf = 100)
, got a list as expected, which contains a data frame with 9 obs with 5 variables.run
g.part1(datadir = "/Users/zhiyuan/Desktop/2024_8_26/Project/5/test", metadatadir = "/Users/zhiyuan/Desktop/2024_8_26/Project/5/out", minimumFileSizeMB = 0, f1 = 1, rmc.nrow = Inf, rmc.skip = 0, rmc.dec = ".", rmc.firstrow.acc = 2, rmc.col.acc = 2:4, rmc.col.temp = 5, rmc.col.time=1, rmc.unit.acc = "g", rmc.unit.temp = "C", rmc.unit.time = "POSIX", rmc.format.time = "%d/%m/%Y %H:%M:%OS", desiredtz = "Europe/London", rmc.sf = 100)
, got output that says "Error in gzfile(file, "wb") : cannot open the connection In addition: Warning message: In gzfile(file, "wb") : cannot open compressed file 'out//meta/basic/meta_mydata.csv.RData', probable reason 'No such file or directory'"Sensor brand: '...'
Data format: 'csv'
Approximate recording duration '...' days
Are you using a sleep diary to guide the sleep detection: YES / NO
Copy of R command used: '....'
Have you tried processing your data based on GGIR's default argument values? Does the issue you report still appear? YES
Expected behavior g.part1 is expected to run without this error message
Screenshots
Desktop (please complete the following information):
Additional context Also tested with data from https://ftp.cdc.gov/pub/pax_g/ data which contains accelerometer raw data for 7 consecutive days, problem still exists
Before submitting
master
branch from GitHub? Tried 3.1-4, 3.1-5