wadpac / GGIR

Code corresponding to R package GGIR
https://wadpac.github.io/GGIR/
Apache License 2.0
99 stars 62 forks source link

Issue 1010 in g.convert.part2.long(), don't evaluate columns that aren't there #1070

Closed l-k- closed 8 months ago

l-k- commented 8 months ago

Fixes #1010

When data has no days with enough valid hours, g.analyse.perday() doesn't add per-day-segment features to daysummary

Later in g.convert.part2.long(), we were attempting to validate these features and this caused the method to crash.

To fix this, I changed the code in g.convert.part2.long() to not evaluate columns that aren't there.

I also cleaned up part of the condition. It looked to me that we want FUN = function(x) all(x=="")), not FUN = function(x) any(x=="")). And also checking for df[,ncol(df)-1] == "" & df[,ncol(df)] == "" doesn't seem necessary because we've already just checked columns up to ncol(df).
I would appreciate it if someone could check if this makes sense.

Checklist before merging:

If NEW GGIR parameter(s) were added then these NEW parameter(s) are :

If GGIR parameter(s) were deprecated these parameter(s) are: