dpwindred / sleepreg

Repository for 'sleepreg' package, for calculating Sleep Regularity Index scores from accelerometer or sleep diary data
GNU Lesser General Public License v3.0
11 stars 1 forks source link

Issue using SRI_from_binary #2

Open zglaros96 opened 2 years ago

zglaros96 commented 2 years ago

Hello,

The package has been great, thank you for creating this. So far it has been working great, but I recently ran into an issue. When running larger files (roughly 190 days worth), half of them give me an error as follows:

[1] "Incorrect input file format: 1190_inflight_all.csv" [1] "SRI analysis complete."

It's strange because the other files, in the exact same file and format, run perfectly well. I was wondering if you ran into this issue at all? Any help would be appreciated.

Thank you, Zach

kmokeeffe commented 5 months ago

Hello,

I'm really keen to use this package, but I am having trouble running the code with the sample data file. I'm not sure if this is because I'm too new to R and have no idea what I'm doing, or if there is an issue.

I have checked that I can read the sample .csv file with read.csv() and I can. I have checked that I have read access to the sample .csv file with file.access() and I do.

But when I run the code for SRI_from_binary, I get the following error:

<simpleError: File 'NA' does not exist or is non-readable. getwd()=='C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data'> <simpleError: file= must be a single character string containing a filename, or URL starting 'http[s]://', 'ftp[s]://' or 'file://'> [1] "SRI analysis complete."

The generated SRI output file is empty. I have tried putting the file on C:/ and still get the same issue, so I don't think it's a OneDrive thing. Any advice would be greatly appreciated.

dpwindred commented 5 months ago

Hi,

Happy to help out - can you please share the code you have used to run the SRI_from_binary function?

On Fri, 22 Mar 2024 at 09:20, kmokeeffe @.***> wrote:

Hello,

I'm really keen to use this package, but I am having trouble running the code with the sample data file. I'm not sure if this is because I'm too new to R and have no idea what I'm doing, or if there is an issue.

I have checked that I can read the sample .csv file with read.csv() and I can. I have checked that I have read access to the sample .csv file with file.access() and I do.

But when I run the code for SRI_from_binary, I get the following error:

<simpleError: File 'NA' does not exist or is non-readable. getwd()=='C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data'> <simpleError: file= must be a single character string containing a filename, or URL starting 'http[s]://', 'ftp[s]://' or 'file://'> [1] "SRI analysis complete."

The generated SRI output file is empty. I have tried putting the file on C:/ and still get the same issue, so I don't think it's a OneDrive thing. Any advice would be greatly appreciated.

— Reply to this email directly, view it on GitHub https://github.com/dpwindred/sleepreg/issues/2#issuecomment-2013951759, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWNGQH3SW4TGBZDLVYGJILYZNMMVAVCNFSM5YICEJPKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBRGM4TKMJXGU4Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kmokeeffe commented 5 months ago

Hi,

That would be fantastic! I've tried several iterations

When setting the working directory to the folder holding SWSdataExample.csv, I have tried:

SRI_from_binary(binarydir = c("SWSdataExample.csv"), tz = "UTC", alloutdir = c(), col.trans = 1, col.timestamp = 2, overwr = FALSE, wr.raster = TRUE, minSRIdays = 5)

When setting the working directory to C:\, I have tried:

SRI_from_binary(binarydir = c("C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data/SWSdataExample.csv"), tz = "UTC", alloutdir = c(), col.trans = 1, col.timestamp = 2, overwr = FALSE, wr.raster = TRUE, minSRIdays = 5)

dpwindred commented 5 months ago

Hi,

It appears to me that your problem is setting the 'binarydir' parameter as the file location, rather than the working directory location.

Instead of binarydir = "C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data/SWSdataExample.csv", try binarydir = "C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data"

On Fri, 22 Mar 2024 at 10:20, kmokeeffe @.***> wrote:

Hi,

That would be fantastic! I've tried several iterations

When setting the working directory to the folder holding SWSdataExample.csv, I have tried:

SRI_from_binary(binarydir = c("SWSdataExample.csv"), tz = "UTC", alloutdir = c(), col.trans = 1, col.timestamp = 2, overwr = FALSE, wr.raster = TRUE, minSRIdays = 5)

When setting the working directory to C:, I have tried:

SRI_from_binary(binarydir = c("C:/Users/XXX/OneDrive - XXX/Desktop/R Files/Data/SWSdataExample.csv"), tz = "UTC", alloutdir = c(), col.trans = 1, col.timestamp = 2, overwr = FALSE, wr.raster = TRUE, minSRIdays = 5)

— Reply to this email directly, view it on GitHub https://github.com/dpwindred/sleepreg/issues/2#issuecomment-2014029938, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWNGQEVUQ6U2MVH4WMO43LYZNTLPAVCNFSM5YICEJPKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBRGQYDEOJZGM4A . You are receiving this because you commented.Message ID: @.***>

kmokeeffe commented 5 months ago

Hi,

Ah! I obviously still have a bit to learn about R coding. That worked

The SRI output file has

File=SWSdataExample.csv SRI=NA SRI_days=4.904861111 SRI_pctl=NA

Is that what I should expect with the sample data?