Open EamonnMallon opened 1 year ago
Hi @EamonnMallon, Thanks for reporting. I will look into that. I am in a bit of a busy time ATM, but should have some time next week. Don't hesitate to update or remind me
For info
dt[, phase := ifelse(t %% hours(24) < hours(12), "L", "D")]
creates the same error
Error: Incompatible classes: <numeric> %% <Period>
but
dt[, phase := ifelse(as.period(t) %% hours(24) < hours(12), "L", "D")]
works.
So I guess it is sometime to do with t being a numeric but timewrap needing period data?
dt_curated$t<-as.period(dt_curated$t) # doesn't work
ggetho(dt_curated, aes(y=asleep, colour=as.factor(sugar)), time_wrap = hours(24)) + stat_pop_etho() + stat_ld_annotations() + facet_grid(as.factor(agar) ~ .) + scale_y_continuous(name= "Fraction of time sleeping",labels = scales::percent)
Just trying to change it to period before running the command doesn't work
ggetho(dt_curated, aes(y=asleep, colour=sleepDeprived), time_wrap = mins(1440)) +
stat_pop_etho() +
stat_ld_annotations() +
scale_y_continuous(name= "Fraction of time sleeping", limits = c(0,1), labels = scales::percent)
This worked. That is when I expressed the timewrap in minutes. So my issue is completely resolved. Not sure if it was due to my data or a more general problem.
I had this issue as well. It comes from a conflict with the lubridate package. I don't load that package anymore and it seems to fix the issue. I'm not sure where lubridate is being used in the rest of the code, but I haven't run into any issues as of yet
I'll give that a try as well. Thanks @epetersen-sci
Hi,
I'm having this problem analysing my own data. I managed to recreate it with the example given in https://rethomics.github.io/ggetho.html
I then get this error
As this is happening with the toy example, I assume it is something to do with other packages perhaps lubridate?