-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
When you try to do an average with more than one "by" you brake the behavr object and you end up with no key.
This is the issue and a potential patch to re-attach the metadata to the resulting summary.
metadata <- data.frame(id = paste0("toy_experiment|",1:2),
condition = c("A", "B"))
dt_test <- toy_activity_data(metadata = metadata)
#to add day number, and light phase
dt_test [,day:=floor(t/days(1))]
dt_test [,phase:=ifelse(t %% hours(24)>hours(12),"Dark","Light")]
dt_test [,phase:=factor(phase, levels= c("Light","Dark"))]
dt_summary_test = dt[,
.(var = mean(asleep))
,keyby=c("id", "phase")]
dt[meta=T][dt_summary_test]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels